/* ===== BIGX — Premium Business Ledger v2 ===== */

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #f8f9fc;
  --bg-dark: #0a0f1e;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e8ecf2;
  --border-light: #f1f5f9;

  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --blue-light: #dbeafe;
  --blue-bg: #eff6ff;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-light: #e0e7ff;

  --green: #10b981;
  --green-light: #d1fae5;
  --green-bg: #ecfdf5;

  --red: #ef4444;
  --red-light: #fee2e2;
  --red-bg: #fef2f2;

  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --amber-bg: #fffbeb;

  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 20px rgba(99,102,241,0.15);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.04), 0 0 1px rgba(0,0,0,0.08);

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-full: 9999px;

  --header-h: 60px;
  --tabs-h: 72px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ===== RESET ===== */

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

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, select, button, textarea { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }

/* ===== LOADING ===== */

#loading {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST ===== */

.toast {
  position: fixed;
  top: -80px;
  left: 50%; transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600;
  z-index: 10000;
  transition: top 0.4s var(--ease-bounce);
  max-width: 88%; text-align: center;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(16px);
  letter-spacing: -0.1px;
}

.toast.show { top: 20px; }
.toast.success { background: rgba(16,185,129,0.95); color: white; }
.toast.error { background: rgba(239,68,68,0.95); color: white; }
.toast.info { background: rgba(10,15,30,0.92); color: white; }

/* ============================================ */
/* ===== LOGIN — PREMIUM GLASSMORPHISM ======= */
/* ============================================ */

#login-screen {
  position: fixed; inset: 0; z-index: 1000;
}

.login-bg {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #0a0f1e 0%, #111936 30%, #1a1055 60%, #2d1b69 80%, #1e40af 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  overflow: hidden;
  position: relative;
}

/* Animated gradient orbs */
.login-bg::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, transparent 70%);
  top: -150px; right: -100px;
  border-radius: 50%;
  animation: orbFloat 8s ease-in-out infinite;
}

.login-bg::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,0.25) 0%, transparent 70%);
  bottom: -120px; left: -80px;
  border-radius: 50%;
  animation: orbFloat 10s ease-in-out infinite reverse;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.login-box {
  width: 100%; max-width: 380px;
  text-align: center;
  position: relative;
  z-index: 2;
  animation: loginEnter 0.8s var(--ease-out) both;
}

@keyframes loginEnter {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, rgba(99,102,241,0.4) 0%, rgba(139,92,246,0.3) 100%);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
  color: white;
  margin-bottom: 24px;
  backdrop-filter: blur(20px);
  box-shadow:
    0 8px 32px rgba(99,102,241,0.3),
    inset 0 1px 0 rgba(255,255,255,0.1);
  animation: logoGlow 3s ease-in-out infinite alternate;
  letter-spacing: -1px;
}

@keyframes logoGlow {
  from { box-shadow: 0 8px 32px rgba(99,102,241,0.3), inset 0 1px 0 rgba(255,255,255,0.1); }
  to { box-shadow: 0 8px 40px rgba(99,102,241,0.5), inset 0 1px 0 rgba(255,255,255,0.15); }
}

.login-box h1 {
  font-size: 36px; font-weight: 800;
  color: white; letter-spacing: -1px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 0%, rgba(255,255,255,0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-box p {
  color: rgba(255,255,255,0.4);
  font-size: 14px; font-weight: 500;
  margin-bottom: 40px;
  letter-spacing: 0.5px;
}

.login-form {
  display: flex; flex-direction: column; gap: 14px;
}

.login-form input {
  width: 100%; padding: 18px 24px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: white; font-size: 16px; font-weight: 500;
  outline: none;
  transition: all 0.3s var(--ease-out);
  text-align: center;
  letter-spacing: 4px;
  backdrop-filter: blur(12px);
}

.login-form input::placeholder {
  color: rgba(255,255,255,0.25);
  letter-spacing: 1px;
  font-weight: 400;
}

.login-form input:focus {
  border-color: rgba(99,102,241,0.6);
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15), 0 4px 20px rgba(99,102,241,0.2);
}

.login-form button {
  width: 100%; padding: 18px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.login-form button::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.login-form button:hover::before { opacity: 1; }

.login-form button:active {
  transform: scale(0.97);
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}

.login-error {
  color: #f87171;
  font-size: 13px; font-weight: 600;
  margin-top: 14px;
  animation: shake 0.5s var(--ease-out);
  background: rgba(239,68,68,0.1);
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(239,68,68,0.2);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ===== HEADER ===== */

#header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 0 60px;
}

#header h1 {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#back-btn {
  position: absolute; left: 6px;
  background: none; border: none;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--accent);
  border-radius: 12px;
  transition: background 0.2s;
}

#back-btn:active { background: var(--accent-light); }

#header-right {
  position: absolute; right: 16px;
}

/* ===== CONTENT ===== */

#content {
  padding-top: calc(var(--header-h) + 12px);
  padding-bottom: calc(var(--tabs-h) + 24px);
  padding-left: 16px; padding-right: 16px;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
}

.page { animation: pageIn 0.35s var(--ease-out); }

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

/* ===== CARDS ===== */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.03);
}

.card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.card-avatar {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  color: white; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

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

.card-title {
  font-weight: 700; font-size: 15px;
  letter-spacing: -0.2px;
  margin-bottom: 2px;
}

.card-sub {
  color: var(--text-secondary);
  font-size: 13px;
}

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

.card-right {
  flex-shrink: 0;
  text-align: right;
}

.card-prices {
  display: flex; gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.card-prices .price-tag {
  font-size: 12px; font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: -0.2px;
  border: 1px solid var(--border-light);
}

.card-actions {
  display: flex; gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.card-borxh-tags {
  display: flex; gap: 6px;
  margin-top: 8px; flex-wrap: wrap;
}

.card-borxh-tags span {
  font-size: 11px; font-weight: 700;
  color: var(--red);
  background: var(--red-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.1px;
}

/* ===== BUTTONS ===== */

.btn {
  padding: 10px 20px;
  border: none; border-radius: var(--radius-xs);
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all 0.2s var(--ease-out);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  letter-spacing: -0.1px;
}

.btn:active { transform: scale(0.95); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

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

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  font-weight: 700;
}

.btn-danger:active { background: var(--red-light); }

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

.btn-outline:active { background: var(--accent-light); border-color: var(--accent); }

/* ===== FAB ===== */

#fab {
  position: fixed;
  bottom: calc(var(--tabs-h) + 20px);
  right: 20px;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  color: white; border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(99,102,241,0.4), 0 2px 8px rgba(99,102,241,0.2);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s var(--ease-out);
}

#fab:active {
  transform: scale(0.88) rotate(90deg);
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}

/* ===== TABS ===== */

#tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--tabs-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
  max-width: 560px;
  margin: 0 auto;
}

.tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  background: none; border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.25s var(--ease-out);
  padding: 8px 0;
  position: relative;
}

.tab span {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.3px;
}

.tab.active {
  color: var(--accent);
}

.tab.active svg {
  transform: scale(1.1);
  transition: transform 0.25s var(--ease-spring);
}

.tab.active::before {
  content: '';
  position: absolute; top: -1px;
  left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 3px;
}

/* ===== BADGES ===== */

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-borxh   { background: var(--red-light); color: var(--red); }
.badge-paguar  { background: var(--green-light); color: var(--green); }
.badge-parapagim { background: var(--amber-light); color: var(--amber); }

/* ===== FORMS ===== */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px; font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  transition: all 0.25s var(--ease-out);
  background: white;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Toggle buttons */
.toggle-group {
  display: flex; gap: 0;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border-light);
}

.toggle-group button {
  flex: 1; padding: 11px 4px;
  border: none; border-radius: 9px;
  background: transparent;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.25s var(--ease-out);
}

.toggle-group button.active {
  background: white;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.toggle-group.status button.s-borxh    { background: var(--red); color: white; box-shadow: 0 2px 8px rgba(239,68,68,0.3); }
.toggle-group.status button.s-paguar   { background: var(--green); color: white; box-shadow: 0 2px 8px rgba(16,185,129,0.3); }
.toggle-group.status button.s-parapagim { background: var(--amber); color: white; box-shadow: 0 2px 8px rgba(245,158,11,0.3); }

/* ===== SEARCH ===== */

.search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-wrap svg {
  position: absolute;
  left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%; padding: 14px 16px 14px 46px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; outline: none;
  background: white; color: var(--text);
  transition: all 0.25s var(--ease-out);
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

/* ===== ARKA FORM ===== */

.arka-form {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
  border: 1px solid rgba(0,0,0,0.03);
}

.arka-form .form-title {
  font-weight: 800; font-size: 17px;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
  color: var(--text);
}

.arka-submit {
  width: 100%; padding: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  color: white; border: none;
  border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.2s var(--ease-out);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
}

.arka-submit::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 50%);
}

.arka-submit:active {
  transform: scale(0.98);
  background: linear-gradient(135deg, var(--accent-dark) 0%, #7c3aed 100%);
}

/* ===== ANALYTICS — COMPACT DASHBOARD ===== */

/* Stat Grid — 2x2 overview */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.03);
}

.stat-label {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 18px; font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.stat-borxh {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-color: rgba(239,68,68,0.1);
}

.stat-borxh .stat-value { color: var(--red); font-size: 15px; }
.stat-borxh .stat-label { color: var(--red); opacity: 0.7; }

.stat-revenue {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: rgba(16,185,129,0.1);
}

.stat-revenue .stat-value { color: var(--green); font-size: 15px; }
.stat-revenue .stat-label { color: var(--green); opacity: 0.7; }

.stat-zero { color: var(--green) !important; }

[data-theme="dark"] .stat-borxh {
  background: linear-gradient(135deg, #1a0505, #2d0a0a);
  border-color: rgba(239,68,68,0.15);
}

[data-theme="dark"] .stat-revenue {
  background: linear-gradient(135deg, #021a0e, #022c22);
  border-color: rgba(16,185,129,0.15);
}

/* Date Filter */
.date-filter {
  display: flex; gap: 0;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-light);
}

.date-filter button {
  flex: 1; padding: 9px 4px;
  border: none; border-radius: 8px;
  background: transparent;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.25s var(--ease-out);
}

.date-filter button.active {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

/* Analytics Section — shared container */
.ana-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.03);
}

.ana-title {
  font-size: 11px; font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

[data-theme="dark"] .ana-section { border-color: rgba(255,255,255,0.04); }

/* Currency Rows — vertical compact */
.cur-row {
  margin-bottom: 14px;
}

.cur-row:last-child { margin-bottom: 0; }

.cur-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.cur-label {
  font-size: 12px; font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.cur-total {
  font-size: 16px; font-weight: 800;
  letter-spacing: -0.3px;
}

.stacked-bar {
  display: flex;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 6px;
}

.stacked-bar .bar-segment {
  height: 100%;
  transition: width 0.6s var(--ease-out);
}

.bar-paguar { background: var(--green); }
.bar-borxh { background: var(--red); }
.bar-parapagim { background: var(--amber); }

.cur-row-bot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cur-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.2px;
}

.cur-green { background: var(--green-light); color: var(--green); }
.cur-red { background: var(--red-light); color: var(--red); }
.cur-amber { background: var(--amber-light); color: var(--amber); }

/* Debtor Rows */
.debtor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: opacity 0.15s;
}

.debtor-row:last-child { border-bottom: none; padding-bottom: 0; }
.debtor-row:first-of-type { padding-top: 0; }
.debtor-row:active { opacity: 0.7; }

.debtor-row .card-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 14px;
}

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

.debtor-name {
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.2px;
}

.debtor-amounts {
  font-size: 12px; font-weight: 600;
  color: var(--red);
  margin-top: 1px;
}

/* Product Rows */
.prod-row {
  margin-bottom: 12px;
}

.prod-row:last-child { margin-bottom: 0; }

.prod-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.prod-name {
  font-size: 13px; font-weight: 700;
  letter-spacing: -0.1px;
}

.prod-qty {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
}

.prod-bar-wrap {
  height: 5px;
  background: var(--bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 3px;
}

.prod-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: var(--radius-full);
  transition: width 0.5s var(--ease-out);
}

.prod-sales {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
}

/* Sparkline — mini activity */
.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
}

.spark-bar {
  flex: 1;
  background: var(--accent-light);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.5s var(--ease-out);
}

.spark-bar.today {
  background: var(--accent);
}

/* Section Headers — still used in client report */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 10px;
}

.section-title {
  font-size: 11px; font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Currency cards — used in client report */
.currencies-grid {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.currency-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-card);
  flex: 1; min-width: 0;
  border: 1px solid rgba(0,0,0,0.03);
}

.currency-card-label {
  font-size: 11px; font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.currency-card-total {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

.breakdown-rows { }

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

.breakdown-row .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}

.breakdown-row .label {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
  display: flex; align-items: center;
}

.breakdown-row .pct {
  font-size: 10px; font-weight: 600;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-amber { background: var(--amber); }

/* ===== TRANSACTION LIST ===== */

.tx-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-left: 4px solid transparent;
  transition: transform 0.15s var(--ease-out);
  border: 1px solid rgba(0,0,0,0.03);
}

.tx-item:active { transform: scale(0.985); }

.tx-item.tx-borxh { border-left: 4px solid var(--red); }
.tx-item.tx-paguar { border-left: 4px solid var(--green); }
.tx-item.tx-parapagim { border-left: 4px solid var(--amber); }

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

.tx-product {
  font-weight: 700; font-size: 14px;
  letter-spacing: -0.2px;
}

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

.tx-right {
  text-align: right;
  flex-shrink: 0;
}

.tx-amount {
  font-weight: 800; font-size: 15px;
  letter-spacing: -0.3px;
}

.tx-right .badge {
  margin-top: 5px;
  cursor: pointer;
  transition: transform 0.15s;
}

.tx-right .badge:active { transform: scale(0.9); }

.tx-actions {
  margin-top: 8px;
}

/* ===== EMPTY STATE ===== */

.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}

.empty-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--bg), var(--border-light));
  border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.empty-icon svg {
  color: var(--text-muted);
  opacity: 0.4;
}

.empty h3 {
  font-size: 17px; font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty p {
  font-size: 14px;
  line-height: 1.5;
}

/* ===== MODAL ===== */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
  backdrop-filter: blur(8px);
}

.modal-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  z-index: 201;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-out);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
}

#modal.show .modal-overlay { opacity: 1; }
#modal.show .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 10px auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 22px 16px;
}

.modal-header h2 {
  font-size: 19px; font-weight: 800;
  letter-spacing: -0.3px;
}

.modal-header button {
  background: var(--bg); border: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.modal-header button:active { background: var(--border); }

#modal-body { padding: 0 22px; }

.modal-footer {
  display: flex; gap: 10px;
  padding: 18px 22px 28px;
}

.modal-footer .btn {
  flex: 1;
  padding: 15px;
  text-align: center;
  font-size: 15px;
  border-radius: var(--radius-sm);
}

.modal-footer .btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

/* ===== STATUS ACTION SHEET ===== */

.status-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 299;
  backdrop-filter: blur(8px);
}

.status-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  z-index: 300;
  padding: 22px 22px 38px;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-out);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
}

.status-sheet.show { transform: translateY(0); }

.status-sheet h3 {
  text-align: center;
  font-size: 15px; font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.status-option {
  width: 100%; padding: 16px;
  border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  text-align: center;
  transition: all 0.2s var(--ease-out);
}

.status-option:active { transform: scale(0.97); }
.status-option.opt-borxh { background: var(--red-light); color: var(--red); }
.status-option.opt-paguar { background: var(--green-light); color: var(--green); }
.status-option.opt-parapagim { background: var(--amber-light); color: var(--amber); }
.status-option.opt-cancel { background: var(--card); color: var(--text-muted); border: 1px solid var(--border); }

/* Payment sheet */
.pay-current {
  text-align: center; padding: 12px 0 16px;
  font-size: 15px; color: var(--text-muted);
}
.pay-current strong { color: var(--red); font-size: 18px; }
.pay-input-wrap {
  position: relative; margin-bottom: 16px;
}
.pay-input {
  width: 100%; padding: 14px 60px 14px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 18px; font-weight: 700;
  background: var(--card); color: var(--text);
  text-align: center;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.pay-input:focus { border-color: var(--accent); outline: none; }
.pay-cur {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 14px; font-weight: 600; color: var(--text-muted);
}
.pay-btn { margin-top: 4px; }

/* ===== RESPONSIVE — TABLET/DESKTOP ===== */

@media (min-width: 560px) {
  #tabs {
    left: 50%;
    transform: translateX(-50%);
    max-width: 560px;
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(0,0,0,0.05);
    border-bottom: none;
  }

  .modal-sheet,
  .status-sheet {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
  }

  #modal.show .modal-sheet { transform: translateX(-50%) translateY(0); }
  .status-sheet.show { transform: translateX(-50%) translateY(0); }
}

/* ============================================ */
/* ===== DARK MODE ============================= */
/* ============================================ */

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-dark: #020617;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --border-light: #1e293b;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.6);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.2), 0 0 1px rgba(0,0,0,0.4);
  --blue-light: #1e3a5f;
  --blue-bg: #172554;
  --green-light: #064e3b;
  --green-bg: #022c22;
  --red-light: #450a0a;
  --red-bg: #2d0a0a;
  --amber-light: #451a03;
  --amber-bg: #2d1300;
  --accent-light: #312e81;
  --purple-light: #2e1065;
}

[data-theme="dark"] #header {
  background: rgba(15,23,42,0.85);
  border-bottom-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] #tabs {
  background: rgba(15,23,42,0.92);
  border-top-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .modal-sheet,
[data-theme="dark"] .status-sheet {
  background: #1e293b;
}

[data-theme="dark"] .card {
  border-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .currency-card,
[data-theme="dark"] .rank-card,
[data-theme="dark"] .activity-chart {
  border-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .search-wrap input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .toggle-group {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .toggle-group button.active {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .date-filter {
  border-color: #334155;
}

[data-theme="dark"] .modal-header button {
  background: #334155;
}

[data-theme="dark"] .arka-form {
  border-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .card-prices .price-tag {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .card-borxh-tags span {
  background: #450a0a;
}

[data-theme="dark"] .rank-item {
  border-bottom-color: #334155;
}

[data-theme="dark"] .tx-item {
  border-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .badge-borxh { background: #450a0a; }
[data-theme="dark"] .badge-paguar { background: #064e3b; }
[data-theme="dark"] .badge-parapagim { background: #451a03; }

[data-theme="dark"] .empty-icon {
  background: linear-gradient(135deg, #1e293b, #334155);
}

/* ============================================ */
/* ===== HEADER BUTTONS ======================= */
/* ============================================ */

#header-right {
  position: absolute; right: 8px;
  display: flex; gap: 2px;
}

#dark-toggle,
#logout-btn {
  background: none; border: none;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 10px;
  transition: all 0.2s;
}

#dark-toggle:active,
#logout-btn:active {
  background: var(--border-light);
  color: var(--text);
}

#logout-btn { color: var(--red); }
#logout-btn:active { background: var(--red-bg); }

/* ============================================ */
/* ===== SWIPE TO DELETE ====================== */
/* ============================================ */

.swipe-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.swipe-bg {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 90px;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.swipe-del {
  color: white;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 12px;
}

.swipe-fg {
  position: relative;
  z-index: 1;
  will-change: transform;
  background: var(--card);
}

.swipe-fg.card {
  margin-bottom: 0;
  border-radius: var(--radius);
}

.swipe-fg.tx-item {
  margin-bottom: 0;
  border-radius: var(--radius);
}

/* ============================================ */
/* ===== PULL TO REFRESH ====================== */
/* ============================================ */

#pull-indicator {
  position: fixed;
  top: var(--header-h);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 90;
  opacity: 0;
}

.pull-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
}

#pull-indicator.refreshing .pull-spinner {
  animation: spin 0.7s linear infinite;
}

/* ============================================ */
/* ===== TAB SLIDE ANIMATIONS ================= */
/* ============================================ */

@keyframes slideInFromRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

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

.page.slide-left {
  animation: slideInFromRight 0.3s var(--ease-out) both;
}

.page.slide-right {
  animation: slideInFromLeft 0.3s var(--ease-out) both;
}
