/* Toss-Style Design System & Responsive Layout */

:root {
  /* Colors */
  --toss-blue: #3182F6;
  --toss-blue-hover: #1b64da;
  --toss-blue-light: #E8F3FF;
  --bg-color: #F2F4F6;
  --card-bg: #FFFFFF;
  
  --text-primary: #191F28;
  --text-secondary: #4E5968;
  --text-muted: #8B95A1;
  --text-link: #3182F6;
  
  --status-income: #00B57A;
  --status-income-light: #E6F8F1;
  --status-expense: #F04452;
  --status-expense-light: #FEECEE;
  
  --border-color: #E5E8EB;
  --border-radius-sm: 10px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.08);
  
  --transition-speed: 0.25s;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-color);
  min-height: 100vh;
  color: var(--text-primary);
  overflow: hidden;
}

/* App Outer Container (Dual-mode: Sidebar + Viewport) */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ----------------------------------------------------
   SIDEBAR (Visible on Desktop / Hidden on Mobile)
   ---------------------------------------------------- */
.app-sidebar {
  display: none; /* Hidden by default on mobile */
  width: 280px;
  min-width: 280px;
  background-color: var(--card-bg);
  border-right: 1px solid var(--border-color);
  flex-direction: column;
  padding: 32px 24px;
  height: 100%;
  z-index: 20;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.logo-icon-wrapper {
  background-color: var(--toss-blue-light);
  color: var(--toss-blue);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon-wrapper svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

.sidebar-logo h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sidebar-club-selector {
  background-color: var(--bg-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background-color var(--transition-speed);
  width: 100%;
}

.sidebar-club-selector:hover {
  background-color: var(--border-color);
}

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

.sidebar-nav .nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-speed);
  text-align: left;
  width: 100%;
}

.sidebar-nav .nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.sidebar-nav .nav-item span {
  font-size: 15px;
  font-weight: 600;
}

.sidebar-nav .nav-item:hover {
  background-color: var(--bg-color);
  color: var(--text-primary);
}

.sidebar-nav .nav-item.active {
  background-color: var(--toss-blue-light);
  color: var(--toss-blue);
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* ----------------------------------------------------
   VIEWPORT (Main Content Area)
   ---------------------------------------------------- */
.app-viewport {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-color);
}

/* Mobile Header */
.app-header {
  height: 64px;
  min-height: 64px;
  padding: 0 24px;
  background-color: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.club-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 12px;
  margin-left: -12px;
  border-radius: var(--border-radius-sm);
  transition: background-color var(--transition-speed);
}

.club-selector:hover {
  background-color: var(--bg-color);
}

.club-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.chevron-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: transform var(--transition-speed);
}

.club-selector:active .chevron-icon {
  transform: translateY(2px);
}

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

/* App Scrollable Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px 20px;
  position: relative;
  scrollbar-width: none;
}

.app-content::-webkit-scrollbar {
  display: none;
}

/* Dynamic Views Switch */
.app-view {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.app-view.active {
  display: flex;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 16px;
  width: 100%;
}

@media (max-width: 768px) {
  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

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

/* Responsive Grid (Stacked on Mobile, Multiple columns on Desktop) */
.desktop-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Typography & Colors */
h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.text-blue { color: var(--toss-blue) !important; }
.text-green { color: var(--status-income) !important; }
.text-red { color: var(--status-expense) !important; }
.text-gray { color: var(--text-muted) !important; }
.text-right { text-align: right; }
.flex-1 { flex: 1; }
.btn-block { width: 100%; display: flex; justify-content: center; align-items: center; }
.hidden { display: none !important; }
.margin-top-lg { margin-top: 24px; }
.font-bold { font-weight: 700; }

/* Card Element */
.card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

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

/* Balance Card */
.balance-card {
  padding: 28px 24px;
  gap: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #fbfbfb 100%);
}

.balance-amount-wrapper {
  display: flex;
  align-items: baseline;
}

.balance-amount {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.balance-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

/* General Buttons */
.btn {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

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

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

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

.btn-sm {
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--border-radius-sm);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

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

.text-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-speed);
}

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

.btn-icon {
  width: 18px;
  height: 18px;
}

/* Quick Menus */
.quick-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.quick-menu-item {
  background-color: var(--card-bg);
  border: none;
  border-radius: var(--border-radius-md);
  padding: 16px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.quick-menu-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-menu-item:active {
  transform: translateY(0) scale(0.96);
}

.quick-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.quick-icon-wrapper.blue { background-color: var(--toss-blue-light); color: var(--toss-blue); }
.quick-icon-wrapper.green { background-color: var(--status-income-light); color: var(--status-income); }
.quick-icon-wrapper.purple { background-color: #F3E8FF; color: #7C3AED; }

.quick-menu-item span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Progress bar Card */
.progress-card {
  gap: 8px;
}

.progress-ratio {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-container {
  height: 8px;
  background-color: var(--bg-color);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  margin: 4px 0;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--toss-blue);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.chip {
  border: none;
  background-color: var(--card-bg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  background-color: var(--border-color);
}

.chip.active {
  background-color: var(--toss-blue-light);
  color: var(--toss-blue);
  font-weight: 700;
}

/* Search and Info Bar */
.search-info-bar {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px;
}

/* Transactions list */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transaction-item {
  background-color: var(--card-bg);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
  border-left: 4px solid transparent;
}

.transaction-item:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
}

.transaction-item.income { border-left-color: var(--status-income); }
.transaction-item.expense { border-left-color: var(--status-expense); }

.tx-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.tx-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.transaction-item.income .tx-icon-circle {
  background-color: var(--status-income-light);
  color: var(--status-income);
}

.transaction-item.expense .tx-icon-circle {
  background-color: var(--status-expense-light);
  color: var(--status-expense);
}

.tx-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tx-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tx-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.tx-tag {
  align-self: flex-end;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-color);
  color: var(--text-secondary);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-muted);
  gap: 12px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  stroke-width: 1.5;
}

.empty-state p {
  font-size: 14px;
  font-weight: 500;
}

/* Members & Fees list */
.settings-mini-card {
  padding: 16px 20px;
  gap: 8px;
}

.fee-info-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.fee-amount-large {
  font-size: 24px;
  font-weight: 800;
}

.fee-period {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.member-list-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 4px 0 4px;
}

.member-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-item {
  background-color: var(--card-bg);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.member-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #E2E8F0;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.member-name {
  font-size: 15px;
  font-weight: 700;
}

.member-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.member-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Toss Toggle Switch */
.toggle-btn {
  border: none;
  background-color: var(--bg-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.toggle-btn.paid {
  background-color: var(--status-income-light);
  color: var(--status-income);
}

.toggle-btn.unpaid {
  background-color: var(--status-expense-light);
  color: var(--status-expense);
}

/* Dutch pay view styles */
.dutchpay-form-card {
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-control {
  border: 1px solid var(--border-color);
  background-color: #FAFBFB;
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-speed);
}

.form-control:focus {
  border-color: var(--toss-blue);
  background-color: #FFFFFF;
  box-shadow: 0 0 0 3px var(--toss-blue-light);
}

.font-large {
  font-size: 20px;
  font-weight: 700;
}

.member-check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--border-radius-sm);
  background-color: #FAFBFB;
}

.member-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}

.member-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--toss-blue);
}

.select-all-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.dutchpay-result-card {
  background: linear-gradient(135deg, #FAFBFB 0%, #FFFFFF 100%);
  border: 1.5px dashed var(--border-color);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.dp-result-summary {
  text-align: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.dp-result-summary h3 {
  font-size: 26px;
  font-weight: 800;
  color: var(--toss-blue);
}

.dp-details-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.dp-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
}

.dp-share-actions {
  margin-top: 8px;
}

/* Statistics view styles */
.month-selector-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background-color: var(--card-bg);
  padding: 14px 20px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
}

.current-month-text {
  font-size: 16px;
  font-weight: 700;
}

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

.stats-card {
  padding: 16px;
  gap: 4px;
}

.stats-card.income { border-top: 4px solid var(--status-income); }
.stats-card.expense { border-top: 4px solid var(--status-expense); }

.stats-card h3 {
  font-size: 18px;
  font-weight: 800;
}

.chart-card {
  min-height: 250px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 200px;
}

/* Bottom Navigation Bar (Visible on Mobile Only) */
.app-navbar {
  height: 72px;
  min-height: 72px;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-speed);
  flex: 1;
  padding: 8px 0;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

.nav-item span {
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active {
  color: var(--toss-blue);
}

.nav-item:active svg {
  transform: scale(0.9);
}

/* Modals & Drawer Overlays */
.modal-overlay, .drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-end; /* Drawer matches bottom sheet */
  justify-content: center;
}

.modal-overlay.active, .drawer-overlay.active {
  display: flex;
}

.modal-overlay {
  align-items: center; /* Modal displays in center */
  padding: 24px;
}

/* Modal Content Box */
.modal-content {
  background-color: var(--card-bg);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header, .drawer-header {
  padding: 18px 24px 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3, .drawer-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: background-color var(--transition-speed);
  flex-shrink: 0;
}

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

.modal-body, .drawer-body {
  padding: 16px 24px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: calc(88vh - 130px);
}

.modal-footer {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-shrink: 0;
}

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

.row-group button {
  background-color: var(--bg-color);
  color: var(--text-secondary);
}

.row-group button.active {
  background-color: var(--toss-blue-light);
  color: var(--toss-blue);
  box-shadow: 0 0 0 2px var(--toss-blue);
}

/* Drawer Content (Bottom Sheet) */
.drawer-content {
  background-color: var(--card-bg);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 70%;
  overflow-y: auto;
  animation: drawerSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.club-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.club-item {
  padding: 16px 20px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.club-item:hover {
  background-color: var(--bg-color);
}

.club-item.active {
  border-color: var(--toss-blue);
  background-color: var(--toss-blue-light);
  font-weight: 700;
  color: var(--toss-blue);
}

/* Settings and Action List inside Modal */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  background-color: #FAFBFB;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  width: 100%;
  transition: background-color var(--transition-speed);
}

.action-item:hover {
  background-color: var(--bg-color);
}

.action-item.danger {
  color: var(--status-expense);
  background-color: var(--status-expense-light);
}

.action-item.danger:hover {
  background-color: #ffd8db;
}

.backup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Toast System */
.toast-container {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(25, 31, 40, 0.9);
  color: #FFFFFF;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
  white-space: nowrap;
}

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

/* Base Layout for Grid Columns */
.desktop-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.desktop-col-left {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.desktop-col-right {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ----------------------------------------------------
   RESPONSIVE MEDIA QUERIES (DESKTOP MODE)
   ---------------------------------------------------- */
@media (min-width: 769px) {
  /* Layout shifts to flex sidebar + viewport */
  .app-sidebar {
    display: flex;
  }
  
  .app-header {
    display: none !important; /* Hide mobile top header */
  }
  
  .app-navbar {
    display: none !important; /* Hide mobile bottom nav */
  }
  
  .app-content {
    padding: 40px; /* Generous spacing on desktop */
  }
  
  /* Desktop layout grid helper */
  .desktop-grid {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 24px !important;
    width: 100% !important;
  }
  
  .desktop-col-left {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }
  
  .desktop-col-right {
    width: 320px !important;
    min-width: 300px !important;
    max-width: 340px !important;
    flex: 0 0 320px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  
  /* Modals are positioned fixed in the center of the viewport */
  .modal-overlay {
    position: fixed;
  }
  
  /* Adjust charts to render side-by-side */
  .chart-card {
    height: 320px;
  }
  .chart-container {
    height: 250px;
  }
  
  /* Toast positioned higher on desktop since there's no bottom tabbar */
  .toast-container {
    bottom: 40px;
  }
}

/* ----------------------------------------------------
   FEE CALENDAR & SUMMARY STYLES
   ---------------------------------------------------- */
.settings-mini-card,
.fee-summary-card,
.unpaid-list-card {
  box-sizing: border-box;
  width: 100%;
}

.fee-info-row {
  display: flex !important;
  align-items: baseline !important;
  justify-content: space-between !important;
  margin-top: 8px !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

.fee-amount-large {
  font-size: 24px !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  white-space: nowrap !important;
  letter-spacing: -0.5px !important;
  line-height: 1.2 !important;
}

.fee-period {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  white-space: nowrap !important;
}

.summary-amounts-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
  padding: 12px 0 !important;
  border-bottom: 1px solid var(--border-color) !important;
  margin-bottom: 8px !important;
}

.summary-amount-block {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 4px !important;
  background: #F8FAFC !important;
  padding: 10px 8px !important;
  border-radius: 8px !important;
}

.amount-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
  white-space: nowrap !important;
}

.amount-value {
  font-size: 18px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}

.unpaid-banner {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 12px 14px !important;
  background: #FFF0F1 !important;
  border-radius: 10px !important;
  margin-top: 6px !important;
  border: 1px solid rgba(240, 68, 82, 0.15) !important;
}

.unpaid-label {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #D32F2F !important;
  white-space: nowrap !important;
}

.unpaid-value {
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #F04452 !important;
  white-space: nowrap !important;
}

/* Calendar controls */
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-month-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ----------------------------------------------------
   FEE STATUS GRID TABLE STYLES
   ---------------------------------------------------- */
.fee-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  margin-top: 10px;
  -webkit-overflow-scrolling: touch;
}

.fee-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px; /* Ensure comfortable horizontal scroll for 12 months */
  text-align: center;
}

.fee-table th, .fee-table td {
  padding: 12px 10px;
  border: 1px solid var(--border-color);
  font-size: 13px;
  vertical-align: middle;
  height: 58px; /* Consistent row height */
  white-space: nowrap;
}

.fee-table th {
  background-color: #F8FAFC;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Sticky first column (Member Name Column) */
.fee-table td:first-child, .fee-table th:first-child {
  position: sticky;
  left: 0;
  background-color: #F8FAFC;
  font-weight: 700;
  z-index: 5;
  min-width: 140px;
  border-right: 2px solid var(--border-color);
  box-shadow: 2px 0 5px rgba(0,0,0,0.02);
}

.fee-table td:first-child {
  background-color: var(--card-bg);
  color: var(--text-primary);
}

/* Row hover highlight */
.fee-table tbody tr:hover td {
  background-color: #FAFAFA;
}
.fee-table tbody tr:hover td:first-child {
  background-color: #F5F7FA;
}

/* Toggled cell states styling */
.fee-table-cell-interactive {
  cursor: pointer;
  transition: background-color var(--transition-speed);
}

.fee-table-cell-interactive:hover {
  background-color: #F2F4F6 !important;
}

/* Status: Unpaid (X Badge) */
.status-x-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--status-expense);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
}

/* Status: Exempt (면제) */
.status-exempt-text {
  color: #00B57A;
  font-weight: 700;
  font-size: 13px;
}

/* Status: Paid (Blue V Checkmark + Date stack) */
.status-paid-check,
.status-paid-amount {
  display: block;
  font-size: 16px;
  font-weight: 900;
  color: var(--toss-blue);
  line-height: 1.2;
}

.status-paid-date {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

/* Table Caption Guide Legend */
.table-guide-legend {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background-color: #FAFBFB;
  border-radius: var(--border-radius-md);
  border: 1px dashed var(--border-color);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  border-radius: 4px;
  padding: 2px 6px;
  min-width: 18px;
  height: 18px;
}

.legend-badge.unpaid {
  background-color: var(--status-expense);
  color: white;
}

.legend-badge.paid {
  background-color: var(--toss-blue);
  color: white;
}

.legend-badge.exempt {
  background-color: var(--status-income-light);
  color: var(--status-income);
}

.legend-badge.not-joined {
  background-color: #E9ECEF;
  color: #6C757D;
}

/* Status: Not Joined Yet (가입 전) */
.status-not-joined {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #8B95A1;
  background-color: #F2F4F6;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.legend-help {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

/* Unpaid list reminders */
.unpaid-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unpaid-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #FAFBFB;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.unpaid-member-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.unpaid-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.unpaid-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--status-expense);
  background-color: var(--status-expense-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.remind-btn {
  border: none;
  background-color: var(--status-expense-light);
  color: var(--status-expense);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
  gap: 4px;
}

.remind-btn:hover {
  background-color: #ffd8db;
}

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

/* Row Member cell with inline delete action */
.table-member-name-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.table-member-name-cell span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-member-name-cell .member-action-btns {
  display: flex;
  gap: 4px;
  opacity: 0.4;
  transition: opacity var(--transition-speed);
}

.fee-table tr:hover .member-action-btns {
  opacity: 1;
}



/* Flex utilities */
.flex-2 {
  flex: 2;
}

/* Settings modal club management list styling */
.settings-club-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 10px;
  background-color: #FAFBFB;
  margin-top: 6px;
}

.settings-club-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  transition: border-color var(--transition-speed);
}

.settings-club-item:hover {
  border-color: var(--toss-blue-light);
}

.settings-club-item-name {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-club-active-badge {
  background-color: var(--toss-blue-light);
  color: var(--toss-blue);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
}

/* Empty State Full Page styling for 0 clubs */
.empty-state-full {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 460px;
  width: 100%;
  background-color: var(--card-bg);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  padding: 60px 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.empty-state-full.active {
  display: flex;
}

.empty-state-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 320px;
}

.empty-icon-large {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
}

.empty-state-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.empty-state-content p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
  line-height: 1.5;
}

/* Dutch pay input layout and tag styles */
.input-group-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.dp-participants-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  min-height: 32px;
}

.dp-participant-tag {
  background-color: var(--toss-blue-light);
  color: var(--toss-blue);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.dp-participant-tag:hover {
  background-color: #e0edff;
}

.dp-participant-tag.is-payer {
  background-color: var(--toss-blue);
  color: #FFFFFF;
}

.dp-participant-tag.is-payer:hover {
  background-color: #1a6fd4;
}

.dp-tag-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition-speed);
  margin-left: 2px;
}

.dp-tag-close:hover {
  opacity: 1;
}

/* Responsive form group rows */
.form-group-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

@media (min-width: 480px) {
  .form-group-row {
    flex-direction: row;
  }
}

/* Supabase configuration panel styles */
.supabase-settings-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.supabase-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.supabase-status-info {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  transition: color var(--transition-speed);
}

/* Google Auth and Profile Styles */
.btn-google-login {
  background-color: #FFFFFF;
  color: #374151;
  border: 1px solid #D1D5DB;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all var(--transition-speed);
}

.btn-google-login:hover {
  background-color: #F9FAFB;
  border-color: #9CA3AF;
}

.user-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
}

.user-profile-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #CBD5E1;
}

.user-details-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-text {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-google-header {
  background-color: #FFFFFF;
  border: 1px solid #D1D5DB;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Mobile Layout and Font Fit Optimizations */
@media (max-width: 768px) {
  .table-member-name-cell .member-action-btns {
    opacity: 0.7; /* Make user action icons visible on mobile/touch screens */
  }
  .view-header .header-actions {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 16px; /* Increase screen usage for content on small devices */
  }
  .app-content {
    padding: 16px 12px 24px 12px; /* Reduce outer padding */
  }
  .empty-state-full {
    padding: 40px 16px;
  }
  .transaction-item {
    padding: 12px 14px; /* Optimize list items vertical size */
  }
}
/* Read-Only mode banner and rules */
.read-only-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #E8F3FF;
  color: var(--toss-blue);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  margin-bottom: 16px;
}

.is-read-only .read-only-hide,
.is-read-only .edit-member-btn,
.is-read-only .delete-member-btn,
.is-read-only .fee-pay-direct-btn,
.is-read-only #addMemberBtn,
.is-read-only #editMonthlyFeeBtn,
.is-read-only #addTransactionBtn,
.is-read-only #addDutchPayBtn,
.is-read-only #homeDepositBtn,
.is-read-only #homeWithdrawBtn,
.is-read-only #quickFeeRequestBtn,
.is-read-only #quickDutchPayBtn,
.is-read-only .btn-edit,
.is-read-only .btn-delete,
.is-read-only .member-action-btns {
  display: none !important;
}

.is-read-only .fee-table-cell-interactive {
  cursor: default !important;
  pointer-events: none !important;
}

.is-read-only .fee-table-cell-interactive:hover {
  background-color: transparent !important;
}

/* Member Unpaid / Paid Chips */
.member-unpaid-chip {
  font-size: 10px;
  font-weight: 700;
  color: var(--status-expense);
  background-color: #FFF0F1;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(240, 68, 82, 0.2);
  display: inline-block;
  white-space: nowrap;
}

.member-paid-chip {
  font-size: 10px;
  font-weight: 700;
  color: var(--toss-blue);
  background-color: var(--toss-blue-light);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}

.member-custom-fee-tag {
  font-size: 10px;
  font-weight: 700;
  color: #7C3AED;
  background-color: #F3E8FF;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  display: inline-block;
  white-space: nowrap;
}

/* Share Card Modal Styles */
.share-card-container {
  background-color: #FFFFFF;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.share-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .share-actions-grid {
    grid-template-columns: 1fr;
  }
}

