:root {
  color-scheme: dark;
  --bg: #050606;
  --surface: #101313;
  --surface-soft: #181d1c;
  --text: #f4f7f5;
  --muted: #929c98;
  --line: #2b3331;
  --accent: #38d6a3;
  --accent-dark: #22b887;
  --danger: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --gold: #d8b75b;
}

* {
  box-sizing: border-box;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softReveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes lineFlow {
  from {
    background-position: -180px 0;
  }

  to {
    background-position: 180px 0;
  }
}

@keyframes markPulse {
  0%,
  100% {
    box-shadow: inset 0 0 18px rgba(56, 214, 163, 0.08), 0 0 0 rgba(56, 214, 163, 0);
  }

  50% {
    box-shadow: inset 0 0 18px rgba(56, 214, 163, 0.12), 0 0 22px rgba(56, 214, 163, 0.16);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(115deg, rgba(56, 214, 163, 0.12), transparent 34%),
    linear-gradient(180deg, #0a0d0c, #050606 420px),
    var(--bg);
  background-size: 30px 30px, 30px 30px, auto, auto, auto;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body::before {
  content: "";
  border: 1px solid rgba(216, 183, 91, 0.16);
  border-left: 0;
  border-right: 0;
  display: block;
  height: 120px;
  left: -8%;
  pointer-events: none;
  position: fixed;
  right: -8%;
  top: 82px;
  transform: rotate(-4deg);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid rgba(56, 214, 163, 0.2);
  border-radius: 8px;
  background: var(--accent);
  color: #03110d;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0 16px;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 24px rgba(34, 184, 135, 0.18);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0) scale(0.98);
}

.secondary {
  background: #1b2020;
  border-color: var(--line);
  color: var(--text);
}

.secondary:hover {
  background: #252b2b;
}

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

.app {
  min-height: 100vh;
  position: relative;
}

.app::after {
  content: "";
  background:
    linear-gradient(90deg, transparent, rgba(216, 183, 91, 0.22), transparent),
    linear-gradient(90deg, transparent, rgba(56, 214, 163, 0.18), transparent);
  background-size: 100% 1px, 100% 1px;
  background-position: 0 0, 0 18px;
  background-repeat: no-repeat;
  bottom: 22px;
  height: 22px;
  left: 8%;
  opacity: 0.65;
  pointer-events: none;
  position: fixed;
  right: 8%;
}

.hidden {
  display: none !important;
}

.topbar,
.status-row {
  display: none !important;
}

.login-screen {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-panel,
.panel,
.summary {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 36%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.login-panel:hover,
.panel:hover,
.summary:hover {
  border-color: #3b4744;
  box-shadow: 0 28px 78px rgba(0, 0, 0, 0.52);
}

.login-panel::before,
.panel::before,
.summary::before {
  content: "";
  display: block;
  height: 3px;
  inset: 0 0 auto;
  position: absolute;
  background: linear-gradient(90deg, transparent, var(--accent), var(--gold), transparent);
  background-size: 180px 3px;
  animation: lineFlow 4s ease-in-out infinite;
}

.login-panel {
  animation: softReveal 420ms ease both;
  max-width: 380px;
  padding: 24px;
  width: 100%;
}

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

.brand-mark {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(56, 214, 163, 0.22), rgba(216, 183, 91, 0.12)),
    #0b0f0e;
  border: 1px solid rgba(56, 214, 163, 0.28);
  border-radius: 8px;
  box-shadow: inset 0 0 18px rgba(56, 214, 163, 0.08);
  color: var(--accent);
  display: flex;
  flex: 0 0 46px;
  font-size: 20px;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 46px;
  animation: markPulse 3.8s ease-in-out infinite;
}

.login-visual {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #0a0d0c;
  background-size: 22px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 22px 0;
  padding: 18px;
}

.login-visual span {
  background: linear-gradient(90deg, rgba(56, 214, 163, 0.9), rgba(216, 183, 91, 0.7));
  border-radius: 999px;
  display: block;
  height: 8px;
  transform-origin: left;
  animation: softReveal 500ms ease both;
}

.login-visual span:nth-child(1) {
  width: 78%;
}

.login-visual span:nth-child(2) {
  animation-delay: 80ms;
  opacity: 0.7;
  width: 54%;
}

.login-visual span:nth-child(3) {
  animation-delay: 160ms;
  opacity: 0.45;
  width: 88%;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 18px;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
}

input {
  background: #0b0d0d;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 44px;
  outline: none;
  padding: 10px 12px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  width: 100%;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 214, 163, 0.16);
  transform: translateY(-1px);
}

input::placeholder {
  color: #5e6965;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin: -4px 0 0;
  min-height: 18px;
}

.dashboard {
  animation: pageIn 360ms ease both;
  margin: 0 auto;
  max-width: 1060px;
  padding: 30px 18px 52px;
}

.summary {
  background:
    linear-gradient(135deg, rgba(56, 214, 163, 0.18), rgba(216, 183, 91, 0.07) 48%, rgba(17, 20, 20, 0.2)),
    var(--surface);
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr auto auto;
  margin-bottom: 18px;
  padding: 24px;
  animation: softReveal 420ms ease both;
  animation-delay: 70ms;
}

.summary > .secondary {
  align-self: start;
}

.summary p {
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.summary strong {
  display: block;
  font-size: 38px;
  line-height: 1.1;
  color: var(--accent);
}

.summary-lines {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  max-width: 360px;
}

.summary-lines span {
  background: linear-gradient(90deg, rgba(56, 214, 163, 0.85), rgba(216, 183, 91, 0.55), transparent);
  border-radius: 999px;
  display: block;
  height: 5px;
  transform-origin: left;
  animation: softReveal 520ms ease both;
}

.summary-lines span:nth-child(2) {
  opacity: 0.65;
  width: 72%;
}

.summary-lines span:nth-child(3) {
  opacity: 0.38;
  width: 48%;
}

.summary-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: 110px 150px;
}

.summary-stats div {
  background: rgba(7, 8, 8, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 12px;
}

.summary-stats span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.summary-stats strong {
  color: var(--text);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.content-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 360px 1fr;
}

.analytics-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.35fr 0.65fr;
}

.analytics-title {
  margin: 22px 0 12px;
}

.analytics-title h2 {
  color: var(--text);
  font-size: 20px;
  margin: 0;
}

.panel {
  animation: softReveal 450ms ease both;
  animation-delay: 120ms;
  padding: 20px;
}

#debtForm {
  align-self: start;
}

.section-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 0;
}

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

.debt-item {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(56, 214, 163, 0.06), transparent 42%),
    var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto auto auto;
  padding: 12px;
  animation: softReveal 260ms ease both;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.debt-item:hover {
  background: #1a1f1f;
  border-color: #34403d;
  transform: translateY(-2px);
}

.debt-name {
  font-weight: 800;
  margin-bottom: 4px;
  position: relative;
}

.debt-name::before {
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(56, 214, 163, 0.6);
  content: "";
  display: inline-block;
  height: 7px;
  margin-right: 8px;
  vertical-align: 1px;
  width: 7px;
}

.debt-number {
  color: var(--muted);
  font-size: 13px;
}

.debt-amount {
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

.pay-btn {
  background: rgba(56, 214, 163, 0.12);
  border-color: rgba(56, 214, 163, 0.28);
  color: var(--accent);
  min-height: 36px;
  padding: 0 12px;
}

.pay-btn:hover {
  background: rgba(56, 214, 163, 0.2);
}

.delete-btn {
  background: rgba(255, 107, 107, 0.11);
  border-color: rgba(255, 107, 107, 0.24);
  color: var(--danger);
  min-height: 36px;
  padding: 0 12px;
}

.delete-btn:hover {
  background: rgba(255, 107, 107, 0.18);
}

.payment-box {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  animation: softReveal 220ms ease both;
  padding-top: 12px;
}

.payment-box label {
  min-width: 0;
}

.payment-box button {
  align-self: end;
}

.payment-box .error {
  grid-column: 1 / -1;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 12px),
    #0c0f0f;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 28px 18px;
  text-align: center;
  animation: softReveal 320ms ease both;
}

.empty-mark {
  align-items: center;
  background: rgba(56, 214, 163, 0.1);
  border: 1px solid rgba(56, 214, 163, 0.2);
  border-radius: 50%;
  color: var(--accent);
  display: flex;
  font-size: 13px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  width: 44px;
  animation: markPulse 3.8s ease-in-out infinite;
}

.empty strong {
  color: var(--text);
  font-size: 15px;
}

.payment-chart {
  display: grid;
  gap: 12px;
  min-height: 156px;
}

.chart-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(110px, 160px) 1fr minmax(92px, auto);
  animation: softReveal 280ms ease both;
}

.chart-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.chart-bar {
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 8px;
  transition: width 300ms ease;
}

.chart-value {
  color: var(--text);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.chart-empty {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 12px),
    #0c0f0f;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 28px 18px;
  text-align: center;
}

.progress-content {
  align-items: center;
  display: grid;
  gap: 18px;
  justify-items: center;
  min-height: 248px;
}

.donut {
  align-items: center;
  background: conic-gradient(var(--accent) 0deg, rgba(255, 255, 255, 0.08) 0deg);
  border-radius: 50%;
  display: flex;
  height: 156px;
  justify-content: center;
  position: relative;
  width: 156px;
}

.donut::after {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
  height: 104px;
  position: absolute;
  width: 104px;
}

.donut span {
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.progress-legend {
  display: grid;
  gap: 10px;
  width: 100%;
}

.progress-legend div {
  align-items: center;
  background: rgba(7, 8, 8, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  padding: 12px;
}

.progress-legend p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.progress-legend strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: right;
}

.legend-dot {
  border-radius: 50%;
  display: block;
  height: 10px;
  width: 10px;
}

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

.legend-dot.unpaid {
  background: rgba(255, 255, 255, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 760px) {
  .dashboard {
    padding-top: 20px;
  }

  .summary strong {
    font-size: 28px;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .summary-stats {
    grid-template-columns: 1fr 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-value {
    text-align: left;
  }

  .debt-item {
    align-items: start;
    grid-template-columns: 1fr auto auto;
  }

  .debt-amount {
    grid-column: 1 / -1;
  }

  .payment-box {
    grid-template-columns: 1fr;
  }
}
