:root {
  --bg: #07070f;
  --panel: rgba(22, 22, 40, 0.72);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f5f3ff;
  --muted: #a8a4c8;
  --pink: #ff4d9d;
  --cyan: #32e6ff;
  --lime: #b8ff4d;
  --violet: #8b5cff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 77, 157, 0.28), transparent 34%),
    radial-gradient(circle at 85% 12%, rgba(50, 230, 255, 0.22), transparent 32%),
    radial-gradient(circle at 70% 80%, rgba(139, 92, 255, 0.24), transparent 38%),
    radial-gradient(circle at 20% 85%, rgba(184, 255, 77, 0.12), transparent 30%),
    #07070f;
}

.topbar {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 20, 0.65);
  backdrop-filter: blur(14px);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 0 24px rgba(255, 77, 157, 0.35);
}

.topbar h1 {
  margin: 0 0 2px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.primary-sm {
  width: auto;
  margin-top: 0;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #061018;
}

.screen-nav {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
  flex-wrap: wrap;
}

.debt-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 16px 0;
}

.debt-card {
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: rgba(22, 22, 40, 0.85);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.debt-card.personal {
  box-shadow: inset 0 0 0 1px rgba(255, 77, 157, 0.25), 0 10px 30px rgba(0, 0, 0, 0.25);
}

.debt-card.business {
  box-shadow: inset 0 0 0 1px rgba(50, 230, 255, 0.25), 0 10px 30px rgba(0, 0, 0, 0.25);
}

.debt-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.debt-value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.debt-value.warn {
  color: #ff7aa8;
}

.debt-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #8b87ad;
}

.screen-tab {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.screen-tab.active {
  background: linear-gradient(135deg, var(--pink), var(--violet));
  border-color: transparent;
}

.screen-tab.andrey.active {
  background: linear-gradient(135deg, var(--cyan), #4f7cff);
}

.screen-tab.maksim.active {
  background: linear-gradient(135deg, var(--lime), #42d6a0);
  color: #0a160b;
}

.screen-badge {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 8, 18, 0.55);
  font-weight: 700;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
}

.hidden {
  display: none !important;
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.report-head h2 {
  margin: 0;
}

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-box {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(8, 8, 18, 0.7);
  white-space: pre-wrap;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  color: #e8e4ff;
}

.span-2 {
  grid-column: span 2;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
}

.glass {
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

label {
  display: block;
  margin-bottom: 10px;
  color: #d8d4ef;
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 8, 18, 0.8);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(50, 230, 255, 0.15);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn.primary {
  width: 100%;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: white;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.danger {
  background: rgba(255, 70, 90, 0.2);
  color: #ff8fa0;
  border: 1px solid rgba(255, 70, 90, 0.35);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.chip.pink {
  background: rgba(255, 77, 157, 0.18);
  color: #ff9cca;
}

.chip.cyan {
  background: rgba(50, 230, 255, 0.15);
  color: #7aefff;
}

.chip.lime {
  background: rgba(184, 255, 77, 0.15);
  color: #d4ff8c;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.form-grid .grow {
  grid-column: span 2;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat {
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 8, 18, 0.55);
}

.stat h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stat p {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat.pink { box-shadow: inset 0 0 0 1px rgba(255, 77, 157, 0.2); }
.stat.cyan { box-shadow: inset 0 0 0 1px rgba(50, 230, 255, 0.2); }
.stat.lime { box-shadow: inset 0 0 0 1px rgba(184, 255, 77, 0.2); }
.stat.violet { box-shadow: inset 0 0 0 1px rgba(139, 92, 255, 0.25); }

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grid4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.rhythm-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(8, 8, 18, 0.45);
}

.rhythm-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-list li {
  margin-bottom: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.task-list li.done span {
  text-decoration: line-through;
  color: var(--muted);
}

.task-meta {
  display: block;
  margin-top: 4px;
  color: #7d79a5;
  font-size: 11px;
}

.mini-btn,
.del-btn {
  width: auto;
  flex-shrink: 0;
  padding: 6px 8px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
}

.mini-btn {
  background: rgba(50, 230, 255, 0.15);
  color: #8ef3ff;
}

.del-btn {
  background: rgba(255, 70, 90, 0.18);
  color: #ff98a6;
}

.limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.limit-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(8, 8, 18, 0.55);
}

.limit-card.over {
  box-shadow: inset 0 0 0 1px rgba(255, 90, 120, 0.45);
}

.limit-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.limit-sum {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.limit-bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.limit-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--lime));
}

.limit-card.over .limit-bar span {
  background: linear-gradient(90deg, #ff4d6d, #ff9f1c);
}

.limit-meta {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
}

tr.pay-overdue td {
  color: #ff9db4;
}

tr.pay-done td {
  color: #9fd89f;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .span-2,
  .form-grid .grow {
    grid-column: span 1;
  }

  .topbar {
    padding: 14px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    padding: 10px 12px;
  }

  .debt-bar {
    grid-template-columns: 1fr;
    padding: 12px 12px 0;
  }

  .debt-value {
    font-size: 24px;
  }

  .screen-nav {
    padding: 12px 12px 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .screen-tab {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid4 {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    margin: 0 -4px;
    padding-bottom: 4px;
  }

  table {
    min-width: 520px;
  }

  .report-actions {
    width: 100%;
  }

  .report-actions .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 480px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .logo {
    width: 40px;
    height: 40px;
  }

  .topbar p {
    font-size: 12px;
  }

  .panel {
    border-radius: 16px;
    padding: 12px;
  }

  .debt-card {
    border-radius: 14px;
  }
}
