:root {
  --bg-base: #07090e;
  --bg-card: #0e121b;
  --bg-card-hover: #141a27;
  --bg-input: #090c12;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.55);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.16);
  --teal: #14b8a6;
  --blue: #38bdf8;
  --amber: #f59e0b;
  --rose: #f43f5e;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  background-image:
    radial-gradient(circle at 15% 0%, rgba(16, 185, 129, 0.08), transparent 35%),
    radial-gradient(circle at 85% 100%, rgba(56, 189, 248, 0.06), transparent 35%);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.hidden {
  display: none !important;
}

/* Lock Screen */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.25rem 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.auth-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(16, 185, 129, 0.4);
  margin: 0 auto 1rem;
  display: block;
  box-shadow: 0 0 25px var(--emerald-glow);
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #04130d;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.25);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.22);
}

.btn-sm {
  padding: 0.38rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* Dashboard Layout */
.app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(16, 185, 129, 0.45);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

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

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.kpi-card.highlight {
  border-color: rgba(16, 185, 129, 0.38);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card) 100%);
}

.kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

.kpi-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.kpi-input {
  background: var(--bg-input);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 0.3rem 0.6rem;
  border-radius: 10px;
  width: 170px;
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.tab-btn.active {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

/* Section Panels */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.35rem;
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.panel-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* Goals Table & Cards */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.data-table th {
  text-align: left;
  padding: 0.75rem 0.75rem;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

table.data-table tr.total-row td {
  border-top: 2px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
  font-weight: 800;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.rank-1 {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.rank-2 {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.rank-3 {
  background: rgba(217, 119, 6, 0.2);
  color: #fdba74;
  border: 1px solid rgba(217, 119, 6, 0.4);
}

.inline-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.42rem 0.6rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  width: 100%;
}

.inline-input:focus {
  outline: none;
  border-color: var(--emerald);
}

.inline-num {
  width: 120px;
  text-align: right;
  font-weight: 700;
}

.progress-bar-outer {
  width: 100%;
  min-width: 110px;
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.3rem;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  border-radius: 99px;
  transition: width 0.25s ease;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-blue {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.icon-btn.danger:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.35);
}

/* Grid for Bills & Debts */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}

.sub-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.1rem;
}

.sub-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}

.bill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0;
  font-size: 0.86rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

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

/* Unsaved Changes Floating Bar */
.save-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 18, 27, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.5);
  border-radius: 14px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.75);
  z-index: 40;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background: #0e1726;
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: var(--text-primary);
  padding: 0.75rem 1.1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  z-index: 60;
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.55);
  color: #fda4af;
}
