/* jygERP Phase 1: Host Management & Buyback Ledger Design System */

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

:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-solid: #1e293b;
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --emerald: #10b981;
  --emerald-light: rgba(16, 185, 129, 0.15);
  
  --amber: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.15);
  
  --pink: #ec4899;
  --pink-light: rgba(236, 72, 153, 0.15);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 80px; /* Space for mobile nav bar */
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: #ffffff;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { color: var(--text-muted); }

/* Layout Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 20px;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--emerald);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.status-dot.connected {
  background-color: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

/* Desktop Navigation */
.desktop-nav {
  display: none;
  gap: 8px;
}

@media (min-width: 768px) {
  body { padding-bottom: 30px; }
  .desktop-nav { display: flex; }
  .mobile-nav { display: none !important; }
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  font-weight: 600;
}

/* Main Container */
.main-content {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out forwards;
}

.tab-pane.active {
  display: block;
}

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

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-glass);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.kpi-card.emerald::before { background: var(--emerald); }
.kpi-card.amber::before { background: var(--amber); }
.kpi-card.pink::before { background: var(--pink); }

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: #ffffff;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

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

.month-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-md);
}

.month-picker-wrap label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.select-clean {
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.select-clean option {
  background-color: var(--bg-card-solid);
  color: #fff;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

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

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-control::placeholder {
  color: var(--text-dim);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

select.form-control option {
  background-color: var(--bg-card-solid);
  color: #fff;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--emerald), #059669);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-emerald:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.btn-secondary {
  background: rgba(51, 65, 85, 0.6);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
}

.btn-full { width: 100%; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Diamonds Inventory tables: scroll inside their card on phones (no table-wrap border) */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(15, 23, 42, 0.8);
  padding: 14px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

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

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: var(--bg-card-hover);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-cash {
  background: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-credit {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-salary {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Host Card Grid */
.host-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.host-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s ease;
}

.host-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.host-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.host-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
}

.host-info-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
}

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

.host-info-label {
  color: var(--text-dim);
}

.host-info-value {
  font-weight: 500;
  color: var(--text-main);
}

/* Live Calc Banner */
.calc-preview-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.1));
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.calc-preview-title {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.calc-preview-amount {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--emerald);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 768px) {
  .toast-container { bottom: 30px; }
}

.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--emerald);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  color: #fff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Mobile Bottom Nav */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px;
}

.mobile-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-family: var(--font-body);
  cursor: pointer;
  flex: 1;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.mobile-nav-btn.active {
  color: var(--primary);
  font-weight: 600;
}

.mobile-nav-icon {
  font-size: 1.2rem;
}

/* ==============================================================================
   MODULE 7: TOTAL WEALTH & NET WORTH STYLING
   ============================================================================== */

/* Utility colors */
.text-emerald { color: #10b981 !important; }
.text-rose { color: #f43f5e !important; }

/* Records couldn't load (e.g. Supabase mode, not logged in): show the reason, hide every screen but Settings */
.data-error-banner { display: none; border-left: 4px solid #f43f5e; }
body.data-unavailable .data-error-banner { display: block; }
body.data-unavailable .tab-pane:not(#tab-settings) { display: none !important; }
.text-amber { color: #f59e0b !important; }
.text-indigo { color: #818cf8 !important; }
.text-cyan { color: #06b6d4 !important; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.btn-amber:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.wealth-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Executive Net Worth Hero Card */
.wealth-hero-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 12px 36px 0 rgba(0, 0, 0, 0.45), 0 0 20px rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.wealth-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981, #6366f1, #06b6d4, #f59e0b);
}

.wealth-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.wealth-hero-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 4px;
}

.wealth-hero-amount {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 60%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.wealth-hero-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #10b981;
}

/* Progress / Composition Bar */
.wealth-progress-container {
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 20px;
}

.wealth-progress-bar {
  display: flex;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.bar-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.bar-cash { background: #10b981; }
.bar-inv { background: #6366f1; }
.bar-rec { background: #06b6d4; }
.bar-diamonds { background: #f59e0b; }
.bar-liab { background: #f43f5e; }

.wealth-progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-cash { background: #10b981; }
.dot-inv { background: #6366f1; }
.dot-rec { background: #06b6d4; }
.dot-diamonds { background: #f59e0b; }
.dot-liab { background: #f43f5e; }

/* Metric Grid inside Hero */
.wealth-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.wealth-metric-item {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.wealth-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.wealth-metric-value {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Wealth Bucket Grid */
.wealth-bucket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.wealth-bucket-card {
  display: flex;
  flex-direction: column;
}

.wealth-bucket-card.full-width {
  grid-column: 1 / -1;
}

.bucket-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.bucket-icon {
  font-size: 1.5rem;
}

.bucket-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.bucket-total {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
}

/* Account List & Items */
.account-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

/* Drag-to-reorder tiles */
.account-list {
  position: relative;
}

.account-list [data-account-tile] {
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.tile-placeholder {
  border: 2px dashed rgba(99, 102, 241, 0.6);
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.08);
}

.account-item.tile-lifted {
  position: fixed;
  z-index: 10000;
  margin: 0;
  pointer-events: none;
  background: rgba(30, 41, 59, 0.97);
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

body.tile-dragging,
body.tile-dragging * {
  cursor: grabbing !important;
  -webkit-user-select: none;
  user-select: none;
}

body.tile-dragging .account-list .account-item {
  pointer-events: none;
}

.account-item:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.account-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.account-item-name {
  font-family: var(--font-heading);
  font-weight: 700;
  color: #fff;
  font-size: 1.05rem;
  line-height: 1.3;
}

.account-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.account-card-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.account-item-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
  max-width: 60%;
}

.account-balance-group {
  text-align: right;
  flex-shrink: 0;
}

.account-item-balance {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.account-item-native {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.btn-log-tx-inline {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-log-tx-inline:hover {
  background: #10b981;
  color: #fff;
  transform: scale(1.04);
}

.account-edit-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.account-edit-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.05);
}

/* Account Transaction Modal Styles */
.modal-card-lg {
  max-width: 680px;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.account-balance-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.tx-form-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.tx-type-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tx-type-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tx-type-btn.active.inflow {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.tx-type-btn.active.outflow {
  background: rgba(244, 63, 94, 0.2);
  border-color: #f43f5e;
  color: #f43f5e;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.2);
}

.tx-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.tx-delete-btn:hover {
  color: var(--rose);
  background: rgba(244, 63, 94, 0.15);
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-glass);
  border-radius: var(--radius-md);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover {
  color: #fff;
}

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

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

/* ==========================================================
   DIAMOND INVENTORY & GOOGLE SHEET SYNC STYLES
   ========================================================== */

.inventory-header {
  flex-wrap: wrap;
  gap: 16px;
}

.inventory-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 500;
}

.status-dot.green {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-dot.red {
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

@keyframes rotateSync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rotating {
  display: inline-block;
  animation: rotateSync 0.8s linear infinite;
}

/* Reseller Allocation Grid */
.inventory-reseller-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.reseller-card {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(22, 27, 46, 0.65);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.reseller-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.reseller-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reseller-icon {
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.05);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.reseller-name {
  font-weight: 700;
  font-size: 1rem;
  color: #f8fafc;
}

.reseller-type {
  font-size: 0.75rem;
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.jyg-badge .reseller-icon {
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.12);
}

.key-badge .reseller-icon {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.12);
}

.rate-badge .reseller-icon {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.12);
}

.reseller-balance {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: -0.02em;
}

.jyg-badge ~ .reseller-balance {
  color: #c084fc;
}

.reseller-quick-edit {
  background: rgba(15, 23, 42, 0.5);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.reseller-quick-edit label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
}

.quick-input-wrap {
  display: flex;
  gap: 8px;
}

.quick-input-wrap input {
  flex: 1;
}

/* JYG Dual Sub-Accounts Layout */
.reseller-subaccounts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(15, 23, 42, 0.5);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

@media (max-width: 640px) {
  .reseller-subaccounts-grid {
    grid-template-columns: 1fr;
  }
}

.subaccount-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subaccount-item label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin: 0;
}

.subaccount-tag {
  color: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.subaccount-desc {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 400;
}

.subaccount-desc code {
  background: rgba(192, 132, 252, 0.15);
  color: #c084fc;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
}

.reseller-sub-breakdown {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.inventory-agents-card {
  margin-bottom: 24px;
}

.table-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.table-actions-right {
  display: flex;
  gap: 8px;
}

.search-input {
  min-width: 220px;
}

.table-total-row {
  background: rgba(245, 158, 11, 0.06);
  border-top: 1px solid rgba(245, 158, 11, 0.2);
}

.table-total-row td {
  padding: 12px 16px;
}

.kpi-card.purple {
  border-top: 3px solid #a855f7;
}

.kpi-card.purple .kpi-value {
  color: #c084fc;
}

.kpi-card.gold {
  border-top: 3px solid #eab308;
}

.kpi-card.gold .kpi-value {
  color: #facc15;
}



