*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0b0f1a;
  --bg-soft: #12182a;
  --card: #fff8e8;
  --card-soft: #f5ebd3;
  --text: #1b1424;
  --muted: #6e6278;

  --gold: #c9a646;
  --gold-soft: #ead790;
  --indigo: #0f1e3a;
  --green: #3f8f6b;
  --red: #b83232;

  --border: rgba(15, 30, 58, 0.18);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(201, 166, 70, 0.18), transparent 40%),
    radial-gradient(circle at bottom right, rgba(63, 143, 107, 0.12), transparent 40%),
    linear-gradient(160deg, #0b0f1a, #0f1e3a);
  color: var(--text);
}

body.locked {
  overflow: hidden;
}

.app {
  width: min(1100px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

h1 {
  margin: 0 0 26px;
  text-align: center;
  color: var(--gold-soft);
  font-size: 42px;
  letter-spacing: 0.04em;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

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

h2 {
  margin: 0 0 14px;
  color: var(--indigo);
  font-size: 24px;
}

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

.add-button,
.login-button {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--indigo), #05070d);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.add-button {
  padding: 10px 14px;
}

.login-button {
  width: 100%;
  padding: 13px 16px;
}

.add-button:hover,
.login-button:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 16px;
}

thead {
  background: var(--indigo);
  color: var(--gold-soft);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

tbody tr {
  background: rgba(255, 255, 255, 0.34);
}

tbody tr:nth-child(even) {
  background: rgba(234, 215, 144, 0.18);
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.name-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.url-link {
  text-decoration: none;
}

.amount {
  font-weight: 700;
  white-space: nowrap;
}

.deficit {
  color: var(--red);
}

.empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* ===== LOGIN OVERLAY ===== */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(13, 10, 20, 0.58);
  backdrop-filter: blur(9px);
}

.login-overlay.hidden {
  display: none;
}

.login-box {
  width: min(100%, 408px);
  background: var(--card);
  border: 1px solid rgba(201, 166, 70, 0.42);
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
}

.login-title {
  margin-bottom: 8px;
  color: var(--indigo);
  font-size: 24px;
  font-weight: 800;
}

.login-subtitle {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
}

.login-input {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 13px 14px;
  margin: 0 0 16px;
  border: 1px solid rgba(15, 30, 58, 0.24);
  border-radius: 14px;
  background: #fffdf7;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.login-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 166, 70, 0.18);
}

.login-error {
  display: none;
  margin-top: 12px;
  color: var(--red);
  font-size: 13px;
}

.login-error.show {
  display: block;
}

.neutral-amount {
  color: var(--text);
}

.past-row {
  opacity: 0.48;
}

.credit {
  color: var(--green);
}

@media (max-width: 700px) {
  .app {
    width: min(100% - 18px, 1100px);
    padding-top: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .card {
    padding: 12px;
    border-radius: 18px;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 14px;
  }

  .name-cell {
    gap: 6px;
  }

  .login-box {
    padding: 24px 18px;
  }
}
