/*
 * Rent Tracker - App-specific styles
 * Uses djust-theming CSS custom properties (--color-*, --space-*, etc.)
 * from base.css bridge layer.
 */

/* ============================================
   Summary Cards (extends stat-card)
   ============================================ */

.summary-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-card-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-card-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-top: var(--space-1);
}

/* ============================================
   Sidebar (app-specific extensions)
   ============================================ */

.sidebar-brand {
  margin-bottom: var(--space-6);
  padding: 0 var(--space-2);
}

.sidebar-brand h1 {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-brand p {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  margin: var(--space-1) 0 0 0;
}

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

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: hsl(var(--sidebar-foreground));
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.sidebar-link:hover {
  color: hsl(var(--sidebar-accent-foreground));
  background: hsl(var(--sidebar-accent));
}

.sidebar-link.active {
  color: hsl(var(--sidebar-primary-foreground));
  background: hsl(var(--sidebar-primary));
  font-weight: var(--font-semibold);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-6);
  border-top: 1px solid hsl(var(--sidebar-border) / 0.5);
}

.sidebar-user {
  padding: var(--space-2);
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text);
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.sidebar-link-danger {
  color: var(--color-danger);
}

.sidebar-link-danger:hover {
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

/* ============================================
   Layout Extensions
   ============================================ */

/* Override base.css app-layout (no top navbar in this app) */
body.app-layout {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

.main-wrapper {
  display: flex;
  flex: 1;
}

.main-content {
  flex: 1;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-6);
  width: 100%;
  animation: fadeIn 0.3s ease-out;
}

/* Override sidebar for this app's layout */
.main-wrapper > .sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: hsl(var(--sidebar-background));
  border-right: 1px solid hsl(var(--sidebar-border) / 0.5);
  padding: var(--space-6) var(--space-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.breadcrumbs a {
  color: var(--color-text-muted);
  transition: color var(--duration-fast);
}

.breadcrumbs a:hover {
  color: var(--color-text-secondary);
}

.breadcrumbs .separator {
  color: var(--color-text-muted);
}

.breadcrumbs .current {
  color: var(--color-text-secondary);
}

/* ============================================
   Expandable Items
   ============================================ */

.expandable-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal);
}

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

.expandable-header {
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.expandable-header:hover {
  background: var(--color-surface);
}

.expandable-body {
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: var(--space-3) 0 var(--space-2) 0;
}

/* ============================================
   Info Cards
   ============================================ */

.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
}

.info-card-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.info-card-value {
  font-weight: var(--font-bold);
  margin-top: var(--space-1);
}

/* ============================================
   Form Card
   ============================================ */

.form-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   Filter Pills
   ============================================ */

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.filter-pill:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.filter-pill.active {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.filter-pill-success.active {
  background: var(--color-success-subtle);
  color: var(--color-success);
  border-color: var(--color-success);
}

.filter-pill-warning.active {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

/* ============================================
   Data Tables
   ============================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

.data-table tbody tr {
  transition: background var(--duration-fast);
}

.data-table tbody tr:hover {
  background: var(--color-surface);
}

/* ============================================
   Table Toolbar & Actions
   ============================================ */

.table-toolbar {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
}

.table-actions {
  white-space: nowrap;
}

.table-actions .btn {
  opacity: 0.5;
  transition: opacity var(--duration-fast);
}

.data-table tbody tr:hover .table-actions .btn {
  opacity: 1;
}

/* Detail row (expanded) */
.detail-row td {
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
}

.detail-row:hover td {
  background: var(--color-surface) !important;
}

/* Sortable headers */
.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--duration-fast);
}

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

.sortable i {
  font-size: 0.65rem;
  margin-left: 2px;
  opacity: 0.4;
  transition: opacity var(--duration-fast);
}

.sortable:hover i {
  opacity: 0.8;
}

.sortable.sort-asc i::before {
  content: "\F128"; /* bi-arrow-up */
}

.sortable.sort-desc i::before {
  content: "\F126"; /* bi-arrow-down */
}

/* ============================================
   Badge Colors
   ============================================ */

.badge-success {
  background: var(--color-success-subtle);
  color: var(--color-success);
}

.badge-danger {
  background: hsl(0 84% 60% / 0.12);
  color: var(--color-danger);
}

.badge-warning {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}

.badge-secondary {
  background: var(--color-surface);
  color: var(--color-text-muted);
}

/* ============================================
   List Items
   ============================================ */

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

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

/* ============================================
   Progress Bar
   ============================================ */

.progress-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-success);
  transition: width 0.5s ease;
}

/* ============================================
   CTA Card
   ============================================ */

.cta-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-primary-subtle);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   Login Page
   ============================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--color-bg);
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-header-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--color-primary), hsl(var(--accent)));
  border-radius: var(--radius-lg);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  margin: 0 auto var(--space-4);
  box-shadow: 0 10px 24px -16px var(--color-primary-glow);
}

.login-header h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin: 0;
}

.login-header p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: var(--space-1) 0 0;
}

.login-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  text-align: center;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-6);
}

/* ============================================
   Inputs (global overrides)
   ============================================ */

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-ring);
}

input::placeholder, textarea::placeholder {
  color: var(--color-text-muted);
}

select option {
  background: var(--color-bg-card);
  color: var(--color-text);
}

label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ============================================
   Mobile
   ============================================ */

.mobile-header {
  display: none;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border-subtle);
  align-items: center;
  justify-content: space-between;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: var(--text-xl);
  color: var(--color-text);
  cursor: pointer;
  padding: var(--space-1);
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .main-wrapper > .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    z-index: 50;
    width: 260px;
    min-width: 260px;
    transition: left 0.3s ease;
    height: 100vh;
    box-shadow: var(--shadow-lg);
  }

  .main-wrapper > .sidebar.open { left: 0; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
  }

  .sidebar-overlay.open { display: block; }

  .main-content { padding: var(--space-4); }

  .responsive-table thead { display: none; }
  .responsive-table tbody tr {
    display: block;
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
  }
  .responsive-table tbody td {
    display: flex;
    justify-content: space-between;
    padding: var(--space-1) 0;
    border: none !important;
  }
  .responsive-table tbody td::before {
    content: attr(data-label);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
  }
}

@media (min-width: 769px) {
  .sidebar-overlay { display: none !important; }
}

/* ============================================
   Grid Extensions (app-specific breakpoints)
   ============================================ */

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

.w-full { width: 100%; }
.cursor-pointer { cursor: pointer; }
.space-y-1 > * + * { margin-top: var(--space-1); }
.space-y-2 > * + * { margin-top: var(--space-2); }
.space-y-3 > * + * { margin-top: var(--space-3); }
.flex-wrap { flex-wrap: wrap; }
.ml-2 { margin-left: var(--space-2); }
.mr-2 { margin-right: var(--space-2); }
.mx-1 { margin-left: var(--space-1); margin-right: var(--space-1); }
.max-h-80 { max-height: 20rem; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }
.overflow-y-auto { overflow-y: auto; }

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-3 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
}

@media (min-width: 769px) {
  .md\:grid-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-4 { grid-template-columns: repeat(4, 1fr); }
  .lg\:grid-5 { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 1024px) {
  .lg\:grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ========== Sidebar Collapse ========== */
.sidebar-collapse-btn {
    background: none;
    border: none;
    color: var(--color-text-muted, #64748b);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 6px);
    transition: all var(--duration-normal, 200ms);
    font-size: 1rem;
}
.sidebar-collapse-btn:hover {
    color: var(--color-text, #fff);
    background: var(--color-surface-hover, rgba(255,255,255,0.08));
}
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Collapsed state */
.sidebar.collapsed {
    width: 64px !important;
    min-width: 64px !important;
}
.sidebar.collapsed .sidebar-label {
    display: none;
}
.sidebar.collapsed .sidebar-brand h1 {
    font-size: 1.25rem;
}
.sidebar.collapsed .sidebar-brand p {
    display: none;
}
.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}
.sidebar.collapsed .sidebar-user-name {
    display: none;
}
.sidebar.collapsed .sidebar-collapse-btn {
    margin: 0 auto;
}
.sidebar.collapsed + .main-content,
.sidebar.collapsed ~ .main-content {
    margin-left: 64px;
}

/* Mobile menu button */
.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--color-text, #fff);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
}

/* Theme toggle in sidebar */
#themeToggleBtn {
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
}

/* ========== Preset Picker ========== */
.preset-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
}
.preset-swatch {
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 2px;
    transition: all var(--duration-fast, 120ms);
}
.preset-swatch span {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}
.preset-swatch:hover {
    border-color: var(--color-text-muted, #64748b);
    transform: scale(1.15);
}
.preset-swatch.active {
    border-color: var(--color-primary, #3b82f6);
    box-shadow: 0 0 0 2px var(--color-primary-subtle, rgba(59,130,246,0.3));
}

/* ========== Mobile Preset Bar ========== */
.mobile-preset-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--color-bg-card, #1e293b);
    border-bottom: 1px solid var(--color-border-subtle, rgba(255,255,255,0.1));
}

/* ========== Profile Popup Menu ========== */
.profile-menu-wrapper {
    position: relative;
}
.profile-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    color: hsl(var(--sidebar-foreground));
    background: transparent;
}
.profile-trigger:hover {
    background: hsl(var(--sidebar-accent));
    color: hsl(var(--sidebar-accent-foreground));
}
.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.profile-avatar-lg {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}
.profile-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 220px;
    background: hsl(var(--popover, var(--card, 0 0% 100%)));
    color: hsl(var(--popover-foreground, var(--card-foreground, 222 47% 11%)));
    border: 1px solid hsl(var(--border, 214 32% 91%) / 0.5);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: var(--space-2, 8px) 0;
    z-index: 100;
    animation: fadeIn 0.15s ease-out;
}
.profile-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--space-3, 12px) var(--space-4, 16px);
}
.profile-popup-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: hsl(var(--foreground));
}
.profile-popup-role {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    text-transform: capitalize;
}
.profile-popup-divider {
    height: 1px;
    background: hsl(var(--border) / 0.5);
    margin: var(--space-1, 4px) 0;
}
.profile-popup-section {
    padding: var(--space-2, 8px) var(--space-4, 16px);
}
.profile-popup-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
    margin-bottom: var(--space-2, 8px);
}
.profile-popup-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px var(--space-4, 16px);
    border: none;
    background: none;
    color: hsl(var(--foreground));
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--duration-fast, 120ms);
    border-radius: 0;
}
.profile-popup-btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}
.profile-popup-btn-danger {
    color: var(--color-danger, #ef4444);
}
.profile-popup-btn-danger:hover {
    background: hsl(0 84% 60% / 0.1);
    color: var(--color-danger, #ef4444);
}
.preset-picker-inline {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
/* Hide profile label + chevron when sidebar collapsed */
.sidebar.collapsed .profile-trigger .sidebar-label,
.sidebar.collapsed .profile-popup { display: none; }

/* ========== Filter Dropdowns ========== */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.filter-group label.filter-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
}
.filter-group select {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md, 8px);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    min-width: 140px;
}
.filter-group select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ============================================
   Payments View - Quick Pay Cards
   ============================================ */

.payments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-4, 1rem);
}

.payment-card {
    position: relative;
    background: var(--color-bg-card, hsl(var(--card)));
    border: 1px solid var(--color-border-subtle, hsl(var(--border)));
    border-radius: var(--radius-xl, 12px);
    padding: var(--space-4, 1rem);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
    overflow: hidden;
}

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

.payment-card--paid {
    border-color: hsl(var(--success, 142 76% 36%) / 0.4);
    background: hsl(var(--success, 142 76% 36%) / 0.03);
}

.payment-card--success {
    border-color: hsl(var(--success, 142 76% 36%) / 0.6);
}

.payment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3, 0.75rem);
}

.payment-card-unit {
    font-weight: var(--font-semibold, 600);
    font-size: var(--text-base, 1rem);
}

.payment-card-tenant {
    font-size: var(--text-sm, 0.875rem);
    color: var(--color-text-muted, hsl(var(--muted-foreground)));
}

.payment-card-amount {
    font-size: var(--text-xl, 1.25rem);
    font-weight: var(--font-bold, 700);
    font-family: var(--font-mono, monospace);
}

.payment-card-meta {
    display: flex;
    gap: var(--space-4, 1rem);
    font-size: var(--text-xs, 0.75rem);
    color: var(--color-text-muted, hsl(var(--muted-foreground)));
    margin-bottom: var(--space-3, 0.75rem);
}

.payment-card-meta i {
    margin-right: 0.25rem;
}

.payment-card-btn {
    width: 100%;
    padding: 0.875rem 1rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    min-height: 52px;
}

/* Quick Pay Form */
.quick-pay-form {
    margin-top: var(--space-3, 0.75rem);
    padding-top: var(--space-3, 0.75rem);
    border-top: 1px solid var(--color-border-subtle, hsl(var(--border)));
}

.quick-pay-form label {
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, hsl(var(--muted-foreground)));
    margin-bottom: 0.25rem;
    display: block;
}

.quick-pay-form input,
.quick-pay-form select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    min-height: 44px;
}

.input-lg {
    font-size: 1.25rem !important;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
}

/* Success Overlay */
.payment-success-overlay {
    position: absolute;
    inset: 0;
    background: hsl(var(--success, 142 76% 36%) / 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
    animation: successFadeIn 0.3s ease;
}

@keyframes successFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.payment-success-icon {
    font-size: 3rem;
    color: white;
    margin-bottom: 0.5rem;
}

.payment-success-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
}

/* Payments mobile optimization */
@media (max-width: 640px) {
    /* Compact summary: single row with just numbers */
    .payments-summary.grid-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    .payments-summary .summary-card {
        padding: 0.5rem;
        text-align: center;
    }
    .payments-summary .summary-card-label {
        font-size: 0.6rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .payments-summary .summary-card-value {
        font-size: 1rem;
    }
    /* Compact month selector */
    .month-filter-bar {
        font-size: 0.85rem;
    }
    .month-filter-bar .btn {
        padding: 0.25rem 0.5rem;
    }
    /* Payment cards */
    .payments-grid {
        grid-template-columns: 1fr;
    }
    .payment-card-btn {
        padding: 1rem !important;
        font-size: 1.125rem !important;
        min-height: 56px;
    }
    /* Hide "Record Expense" text, show icon only */
    .expense-btn-text { display: none; }
}

/* ============================================
   Mobile Responsive Tables
   ============================================ */

@media (max-width: 768px) {
    .table-toolbar .flex {
        flex-direction: column;
        align-items: stretch;
    }
    .table-toolbar .filter-pill {
        text-align: center;
    }

    .responsive-table thead {
        display: none;
    }
    .responsive-table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--color-border-subtle, hsl(var(--border)));
        border-radius: var(--radius-lg, 8px);
        padding: 0.75rem;
        background: var(--color-bg-card, hsl(var(--card)));
    }
    .responsive-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.375rem 0;
        border: none;
        font-size: 0.875rem;
    }
    .responsive-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--color-text-muted, hsl(var(--muted-foreground)));
        margin-right: 1rem;
        flex-shrink: 0;
    }
    .responsive-table tbody td.text-right {
        text-align: right;
    }
}

/* ========== Theme Mode Buttons ========== */
.theme-mode-buttons {
    display: flex;
    gap: 4px;
    padding: 0 var(--space-4, 16px);
    margin-bottom: 4px;
}
.theme-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md, 8px);
    background: transparent;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}
.theme-mode-btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}
.theme-mode-btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

/* ========== Logout Button ========== */
.profile-popup-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 16px);
    margin: 8px auto;
    padding: 8px;
    border: 1px solid hsl(var(--destructive, 0 84% 60%) / 0.3);
    border-radius: var(--radius-md, 8px);
    background: hsl(var(--destructive, 0 84% 60%) / 0.1);
    color: hsl(var(--destructive, 0 84% 60%));
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.profile-popup-logout:hover {
    background: hsl(var(--destructive, 0 84% 60%) / 0.2);
    border-color: hsl(var(--destructive, 0 84% 60%) / 0.5);
}
