﻿@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  --bg: #0b1220;
  --bg-soft: #121a2a;
  --card: #151e30;
  --card-soft: #1a253a;
  --border: #25314a;
  --text: #eef2ff;
  --muted: #9aa7bd;
  --accent: #f97316;
  --accent-soft: #fb923c;
  --teal: #14b8a6;
  --green: #22c55e;
  --lime: #a3e635;
  --purple: #7c3aed;
  --amber: #f59e0b;
  --shadow: 0 20px 40px rgba(5, 10, 20, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top left, #1b2944 0%, #0b1220 55%),
    radial-gradient(circle at 80% 20%, rgba(15, 118, 110, 0.18), transparent 55%);
  color: var(--text);
}

h1, h2, h3 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  margin: 0;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.app {
  display: block;
  min-height: 100vh;
}

.app.hidden {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.workspace.hidden {
  display: none;
}

.sidebar {
  background: linear-gradient(180deg, #111a2a 0%, #0b1220 100%);
  padding: 28px 20px;
  border-right: 1px solid #162135;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f97316 0%, #fbbf24 100%);
  display: grid;
  place-items: center;
}

.icon-bars {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: #0b1220;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.brand-title {
  font-weight: 600;
  font-size: 18px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  background: #121c2d;
  border: 1px solid transparent;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item:hover {
  border-color: #23324c;
  background: #172439;
}

.nav-item.active {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #111827;
  font-weight: 600;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
}

.sidebar-actions .pill,
.sidebar-actions .action-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.sidebar-footer {
  margin-top: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #0f182a;
  border-radius: 16px;
  border: 1px solid #1e2b41;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #223046;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.user-name {
  font-size: 14px;
}

.user-role {
  font-size: 12px;
  color: var(--muted);
}

.main {
  padding: 32px 28px 48px;
}

.pill {
  padding: 10px 16px;
  border-radius: 999px;
  background: #1b263c;
  border: 1px solid #27324a;
  font-size: 13px;
}

.pill.ghost {
  background: #152033;
  color: var(--muted);
}

.action-btn {
  cursor: pointer;
}

.tab-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.tab-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 20px;
  min-height: 74px;
  display: grid;
  align-content: center;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.tab-card:hover {
  border-color: #2b3a55;
}

.tab-card.active {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #111827;
  border-color: transparent;
}

.tab-card.active .tab-sub {
  color: rgba(17, 24, 39, 0.8);
}

.tab-title {
  font-size: 16px;
  font-weight: 600;
}

.tab-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.tab-panels {
  margin-top: 18px;
}

.tab-panel {
  display: none;
}

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

.month-row {
  margin-top: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cages-panels {
  display: grid;
  gap: 20px;
}

.cages-panel {
  display: none;
}

.cages-panel.active {
  display: block;
}

.cages-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.kpi-value {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 26px;
  font-weight: 600;
}

.data-table {
  display: grid;
  gap: 10px;
}

.data-table.editable {
  gap: 8px;
}

.data-row {
  display: grid;
  grid-template-columns: 64px 1fr 170px 130px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #111a2a;
  border: 1px solid #25314a;
}

.data-row.head {
  background: #0f182a;
  border-color: #2a3652;
  font-weight: 600;
}

.data-cell {
  font-size: 13px;
}

.data-cell.muted {
  color: var(--muted);
}

.data-row .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-row .select,
.data-row .input {
  width: 100%;
  background: #101827;
  border: 1px solid #26324b;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
}

.data-row .select {
  cursor: pointer;
}

.save-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

.cages-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.cages-targets.single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 420px;
}

.cages-target {
  background: #111a2a;
  border: 1px solid #25314a;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.cages-target label {
  font-size: 12px;
  color: var(--muted);
}

.cages-target .input {
  width: 100%;
  background: #101827;
  border: 1px solid #26324b;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
}

.cages-target .input.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.timeline-row,
.doc-row {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #111a2a;
  border: 1px solid #25314a;
}

.timeline-row {
  grid-template-columns: 64px 1fr 150px 150px 1.2fr;
}

.doc-row {
  grid-template-columns: 64px 1fr 1.2fr 1.2fr;
}

.timeline-row.head,
.doc-row.head {
  background: #0f182a;
  border-color: #2a3652;
  font-weight: 600;
}

.timeline-row .input,
.timeline-row .select,
.doc-row .input,
.doc-row .select {
  width: 100%;
  background: #101827;
  border: 1px solid #26324b;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
}

.timeline-row .select,
.doc-row .select {
  cursor: pointer;
}

.data-row .input:disabled,
.data-row .select:disabled,
.rab-row .input:disabled,
.cages-target .input:disabled,
.timeline-row .input:disabled,
.timeline-row .select:disabled,
.doc-row .input:disabled,
.doc-row .select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.rab-sections {
  display: grid;
  gap: 14px;
}

.rab-section {
  border: 1px solid #25314a;
  border-radius: 16px;
  background: #101827;
  overflow: hidden;
}

.rab-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #0f182a;
  border-bottom: 1px solid #25314a;
}

.rab-section-title {
  font-weight: 600;
}

.rab-section-body {
  padding: 12px 12px 14px;
  display: grid;
  gap: 10px;
}

.rab-row {
  display: grid;
  grid-template-columns: 1fr 160px 160px 160px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: #111a2a;
  border: 1px solid #25314a;
}

.rab-row.head {
  background: #0f182a;
  font-weight: 600;
}

.rab-row .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rab-row .input {
  width: 100%;
  background: #101827;
  border: 1px solid #26324b;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.month-chip {
  background: #172238;
  border: 1px solid #26324b;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.month-chip.active {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #111827;
  border-color: transparent;
  font-weight: 600;
}

.dashboard-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: floatIn 0.6s ease both;
  animation-delay: calc(var(--delay) * 0.06s);
}

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

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

.card-header h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.legend {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

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

.dot.expense {
  background: var(--accent);
}

.chart-wrap {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  align-items: center;
}

.line-chart {
  width: 100%;
  height: 180px;
}

.line-chart .grid {
  fill: none;
  stroke: #202b41;
  stroke-width: 1;
}

.line-chart .line {
  fill: none;
  stroke-width: 3;
}

.line-chart .line.income {
  stroke: var(--green);
}

.line-chart .line.expense {
  stroke: var(--accent);
}

.line-chart .area.income {
  fill: url(#incomeGrad);
  opacity: 0.4;
}

.line-chart .area.expense {
  fill: url(#expenseGrad);
  opacity: 0.35;
}

.ratio {
  background: var(--card-soft);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  border: 1px solid #23324a;
}

.ratio-title {
  font-size: 13px;
  color: var(--muted);
}

.donut {
  width: 120px;
  height: 120px;
  margin: 12px auto 8px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--value) * 1%), #24324a 0);
  display: grid;
  place-items: center;
}

.donut-center {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #0d1526;
  display: grid;
  place-items: center;
  border: 1px solid #1f2c43;
}

.donut-value {
  font-weight: 600;
  font-size: 18px;
}

.donut-label {
  font-size: 11px;
  color: var(--muted);
}

.ratio-note {
  font-size: 12px;
  color: var(--muted);
}

.card-income {
  grid-column: span 8;
}

.card-card {
  grid-column: span 4;
}

.credit {
  background: linear-gradient(135deg, #1f2b44 0%, #24354e 50%, #101828 100%);
  border-radius: 18px;
  padding: 18px;
  min-height: 220px;
  position: relative;
  overflow: hidden;
  border: 1px solid #2b3b54;
}

.credit::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.4), transparent 70%);
  top: -60px;
  right: -40px;
}

.credit-chip {
  width: 44px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  margin-bottom: 18px;
}

.credit-brand {
  font-size: 14px;
  color: var(--muted);
}

.credit-number {
  font-size: 16px;
  letter-spacing: 2px;
  margin: 18px 0;
}

.credit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.credit-footer .label {
  font-size: 12px;
  color: var(--muted);
}

.credit-footer .value {
  font-size: 16px;
  font-weight: 600;
}

.badge {
  background: #162035;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #2a3a55;
  font-size: 12px;
}

.card-source,
.card-trend,
.card-budget,
.card-invest,
.card-goals,
.card-debts,
.card-total {
  grid-column: span 4;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 12px;
  color: var(--muted);
}

.bar {
  position: relative;
  background: #1b263c;
  border: 1px solid #2a3652;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  overflow: hidden;
}

.bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--w) * 1%);
  background: linear-gradient(90deg, #14b8a6, #22c55e);
  opacity: 0.7;
}

.bar {
  color: #e5e7eb;
}

.mini-chart {
  width: 100%;
  height: 120px;
}

.mini-chart .grid {
  stroke: #202b41;
  stroke-width: 1;
  fill: none;
}

.mini-chart .line.accent {
  stroke: #38bdf8;
  stroke-width: 3;
  fill: none;
}

.trend-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.ring {
  width: 140px;
  height: 140px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(#8b5cf6 calc(var(--value) * 1%), #27324a 0);
  position: relative;
}

.ring::after {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: #101828;
  border: 1px solid #27324a;
}

.ring-caption {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

.stack-item {
  padding: 10px 12px;
  border-radius: 14px;
  background: #111a2a;
  border: 1px solid #26324b;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.radial {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(#f97316 calc(var(--value) * 1%), #2a3652 0);
  display: grid;
  place-items: center;
  border: 1px solid #2a3652;
}

.radial-center {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #101828;
  display: grid;
  place-items: center;
}

.radial-value {
  font-size: 18px;
  font-weight: 600;
}

.radial-label {
  font-size: 11px;
  color: var(--muted);
}

.goal-note,
.debt-value {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.bubbles {
  position: relative;
  height: 140px;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #0b1220;
  font-weight: 600;
}

.b1 {
  width: 90px;
  height: 90px;
  background: #38bdf8;
  top: 10px;
  left: 10px;
}

.b2 {
  width: 70px;
  height: 70px;
  background: #a3e635;
  top: 50px;
  left: 100px;
}

.b3 {
  width: 55px;
  height: 55px;
  background: #f59e0b;
  top: 20px;
  left: 170px;
}

.total-list {
  display: grid;
  gap: 10px;
}

.total-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #111a2a;
  border-radius: 14px;
  padding: 10px;
  border: 1px solid #25314a;
}

.total-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.total-icon.orange { background: #f97316; }
.total-icon.teal { background: #14b8a6; }
.total-icon.purple { background: #a855f7; }
.total-icon.lime { background: #a3e635; }
.total-icon.amber { background: #f59e0b; }

.total-item .label {
  font-size: 12px;
  color: var(--muted);
}

.total-item .value {
  font-size: 14px;
  font-weight: 600;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 22, 0.75);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 40;
}

.overlay.hidden {
  display: none;
}

.auth-card,
.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
}

.auth-card h2,
.admin-card h2 {
  margin-bottom: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
}

.field span {
  color: var(--muted);
}

.field input {
  background: #101827;
  border: 1px solid #26324b;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}

.primary-btn {
  margin-top: 16px;
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #111827;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

.form-note {
  margin-top: 10px;
  font-size: 12px;
  color: #fca5a5;
  min-height: 16px;
}

.admin-card {
  width: min(560px, 92vw);
}

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

.ghost-btn {
  background: #152033;
  border: 1px solid #26324b;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-row {
  background: #111a2a;
  border: 1px solid #25314a;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.admin-row .user-meta {
  display: grid;
  gap: 4px;
}

.admin-row .user-meta span {
  font-size: 12px;
  color: var(--muted);
}

.admin-row .pin-output {
  font-size: 12px;
  color: #fcd34d;
  margin-top: 6px;
}

.admin-row button {
  background: #1b263c;
  border: 1px solid #2b3a55;
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .card-income,
  .card-card,
  .card-source,
  .card-trend,
  .card-budget,
  .card-invest,
  .card-goals,
  .card-debts,
  .card-total {
    grid-column: span 6;
  }
  .chart-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar-footer {
    display: none;
  }
  .tab-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 20px 16px 32px;
  }
  .card {
    padding: 16px;
  }
  .line-chart {
    height: 150px;
  }
}
