/* Demo CRM - Customer Ledger System — Modern UI */

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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-50: rgba(99, 102, 241, 0.08);
  --primary-glow: rgba(99, 102, 241, 0.25);
  --success: #10b981;
  --success-hover: #059669;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: rgba(99, 102, 241, 0.15);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #fff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.2);
  --sidebar-width: 260px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════ LOGIN SCREEN ═══════════════ */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(244, 63, 94, 0.08) 0%, transparent 50%);
  animation: loginBgFloat 20s ease-in-out infinite;
}

@keyframes loginBgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

.login-card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 1;
  animation: loginCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.login-logo svg {
  color: #fff;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: -0.5px;
}

.login-card .subtitle {
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 32px;
  font-size: 15px;
  font-weight: 400;
}

.login-card .demo-info {
  background: linear-gradient(135deg, var(--primary-light) 0%, #f5f3ff 100%);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--primary-hover);
}

.login-card .demo-info strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-card .demo-info code {
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  font-weight: 600;
}

/* ═══════════════ FORM ELEMENTS ═══════════════ */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  transition: var(--transition);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: var(--gray-300);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-50);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--gray-400);
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

.form-group input[type="date"] {
  cursor: pointer;
}

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

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

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-success:hover {
  background: var(--success-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: #fff;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.btn-outline::after {
  display: none;
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
  padding: 12px 22px;
}

/* ═══════════════ APP LAYOUT WITH SIDEBAR ═══════════════ */
.app-wrapper {
  display: none;
  min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-icon svg {
  color: #fff;
  width: 20px;
  height: 20px;
}

.sidebar-brand-text {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--sidebar-text);
  letter-spacing: 0;
  margin-top: 1px;
}

/* Sidebar Nav */
.sidebar-nav {
  padding: 0 12px;
  flex: 1;
}

.sidebar-nav-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 20px 12px 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav-item.active {
  background: var(--sidebar-active);
  color: var(--primary);
}

.sidebar-nav-item.active svg {
  color: var(--primary);
}

.sidebar-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav-item:hover svg {
  opacity: 1;
}

.sidebar-nav-item.active svg {
  opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: var(--transition);
}

.sidebar-user:hover {
  background: var(--sidebar-hover);
}

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--sidebar-text);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* Main Content Area */
.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.topbar {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}

.topbar-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 400;
}

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

.btn-reset {
  background: none;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-500);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-reset:hover {
  border-color: var(--gray-300);
  color: var(--gray-700);
  background: var(--gray-50);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 8px;
  color: var(--gray-600);
  cursor: pointer;
}

/* Main Content */
.main-content {
  padding: 32px;
  max-width: 1280px;
  width: 100%;
  animation: contentFadeIn 0.3s ease;
}

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

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.5px;
}

.page-header .page-desc {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 4px;
  font-weight: 400;
}

/* ═══════════════ SUMMARY CARDS ═══════════════ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.summary-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}

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

.summary-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-card-icon svg {
  width: 22px;
  height: 22px;
}

.summary-card-icon.icon-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.summary-card-icon.icon-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.summary-card-icon.icon-success {
  background: var(--success-light);
  color: var(--success);
}

.summary-card-icon.icon-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.summary-card-content {
  flex: 1;
  min-width: 0;
}

.summary-card .label {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.summary-card .value {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

/* ═══════════════ SEARCH ═══════════════ */
.search-bar {
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  max-width: 440px;
  padding: 11px 16px 11px 44px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") 14px center no-repeat;
  transition: var(--transition);
}

.search-bar input::placeholder {
  color: var(--gray-400);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-50);
}

/* ═══════════════ TABLE ═══════════════ */
.table-wrapper {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}

tbody td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background: var(--gray-50);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover {
  background: var(--primary-50);
}

/* Customer row styling */
.customer-row-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.customer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.customer-avatar.bg-1 { background: linear-gradient(135deg, #6366f1, #818cf8); }
.customer-avatar.bg-2 { background: linear-gradient(135deg, #ec4899, #f472b6); }
.customer-avatar.bg-3 { background: linear-gradient(135deg, #10b981, #34d399); }
.customer-avatar.bg-4 { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.customer-avatar.bg-5 { background: linear-gradient(135deg, #ef4444, #f87171); }
.customer-avatar.bg-6 { background: linear-gradient(135deg, #06b6d4, #22d3ee); }

.customer-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 14px;
}

.customer-company {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 1px;
}

.text-muted {
  color: var(--gray-500);
  font-size: 13px;
}

/* ═══════════════ BADGES ═══════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-debit {
  background: var(--danger-light);
  color: var(--danger);
}

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

/* Amount styling */
.amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.amount-debit {
  color: var(--danger);
}

.amount-credit {
  color: var(--success);
}

.balance-positive {
  color: var(--danger);
  font-weight: 700;
}

.balance-zero {
  color: var(--success);
  font-weight: 700;
}

.activity-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}

.activity-count svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

/* ═══════════════ CUSTOMER DETAIL ═══════════════ */

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-500);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
  padding: 6px 12px 6px 8px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.back-link:hover {
  color: var(--primary);
  background: var(--primary-50);
}

/* Customer Header Card */
.customer-header {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.customer-header-top {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.customer-header-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  flex-shrink: 0;
}

.customer-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 2px;
  letter-spacing: -0.5px;
}

.customer-header .company {
  color: var(--gray-500);
  font-size: 14px;
  font-weight: 500;
}

.customer-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

.customer-meta-item {
  font-size: 13px;
  color: var(--gray-600);
}

.customer-meta-item .meta-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  margin-bottom: 4px;
}

.customer-meta-item .meta-value {
  font-weight: 500;
  color: var(--gray-800);
}

/* Balance Display */
.balance-display {
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1e293b 100%);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.balance-display::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.balance-display .label {
  font-size: 12px;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-weight: 600;
}

.balance-display .balance-amount {
  font-size: 42px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
}

.balance-display .balance-amount.balance-positive {
  color: #fca5a5;
}

.balance-display .balance-amount.balance-zero {
  color: #6ee7b7;
}

.balance-display .balance-status {
  font-size: 13px;
  margin-top: 8px;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}

.section-header .actions {
  display: flex;
  gap: 10px;
}

/* ═══════════════ MODALS ═══════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: overlayIn 0.2s ease;
}

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

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}

.modal-close {
  background: var(--gray-100);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.modal-body {
  padding: 0 28px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ═══════════════ TOAST NOTIFICATIONS ═══════════════ */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 20px 14px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--gray-800);
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--gray-100);
  font-weight: 500;
}

.toast::before {
  content: "";
  width: 4px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--primary);
}

.toast.toast-success::before {
  background: var(--success);
}

.toast.toast-error::before {
  background: var(--danger);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* Delete button in table */
.btn-delete-row {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-delete-row:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 1024px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.3);
  }

  .mobile-menu-btn {
    display: flex;
  }

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

  .mobile-overlay.active {
    display: block;
  }

  .main-area {
    margin-left: 0;
  }

  .main-content {
    padding: 20px;
  }

  .topbar {
    padding: 0 20px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .customer-header-top {
    flex-direction: column;
    gap: 16px;
  }

  .customer-meta {
    grid-template-columns: 1fr 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section-header .actions {
    width: 100%;
  }

  .section-header .actions .btn {
    flex: 1;
  }

  .search-bar input {
    max-width: 100%;
  }

  .balance-display .balance-amount {
    font-size: 32px;
  }
}

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

  .login-card {
    padding: 32px 24px;
    border-radius: 16px;
  }

  .customer-meta {
    grid-template-columns: 1fr;
  }
}
