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

:root {
  --bg: #0b1120;
  --bg-soft: #111827;
  --panel: #172033;
  --panel-2: #1e293b;
  --line: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #9ca3af;
  --accent: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --radius: 18px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.08), transparent 30%),
    linear-gradient(180deg, #0b1120 0%, #0f172a 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.header {
  padding: 32px 20px 18px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.signout-btn {
  margin-top: 10px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.07);
  color: #9ca3af;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.sync-error {
  background: rgba(239, 68, 68, 0.12);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.88rem;
  text-align: center;
  padding: 10px 16px;
}

.header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.tagline {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.98rem;
}

.search-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.92);
  position: sticky;
  top: 91px;
  z-index: 19;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input-wrap input {
  flex: 1;
  margin-top: 0;
  background: rgba(255, 255, 255, 0.05);
}

.search-btn {
  flex-shrink: 0;
  margin-top: 0;
  padding: 12px 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav {
  display: flex;
  gap: 10px;
  padding: 16px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.9);
  position: sticky;
  top: 157px;
  z-index: 18;
}

.nav::-webkit-scrollbar {
  height: 6px;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.nav button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.95rem;
  transition: 0.2s ease;
}

.nav button:hover {
  background: var(--panel-2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.section {
  display: none;
  background: rgba(23, 32, 51, 0.9);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.section.active {
  display: block;
}

.section h2 {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.section h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.section p {
  color: var(--muted);
  margin-bottom: 14px;
}

input,
textarea,
button,
select {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px 15px;
  margin-top: 12px;
  outline: none;
  transition: 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

textarea {
  min-height: 180px;
  resize: vertical;
}

button {
  margin-top: 12px;
  background: linear-gradient(180deg, var(--accent) 0%, #0ea5e9 100%);
  color: #04111d;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

ul {
  list-style: none;
  margin-top: 16px;
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.list-item span {
  flex: 1;
  word-break: break-word;
}

.list-item a {
  color: var(--accent);
  text-decoration: none;
}

.list-item a:hover {
  text-decoration: underline;
}

.list-item button {
  margin-top: 0;
  padding: 9px 12px;
  border-radius: 10px;
  min-width: 74px;
}

.list-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.list-actions select {
  min-width: 150px;
  margin-top: 0;
  padding: 9px 12px;
  border-radius: 10px;
}

.money-in {
  color: var(--green);
  font-weight: 700;
}

.money-out {
  color: var(--red);
  font-weight: 700;
}

.paid {
  color: var(--green);
  font-weight: 700;
}

.unpaid {
  color: var(--red);
  font-weight: 700;
}

.folder-panel {
  margin-top: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.folder-toolbar {
  display: grid;
  gap: 16px;
}

.folder-select-wrap label,
.folder-add-wrap label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.inline-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-row input {
  flex: 1;
  min-width: 220px;
  margin-top: 0;
}

.inline-row button {
  margin-top: 0;
}

.folder-actions {
  margin-top: 14px;
}

.folder-hint,
.section-folder-label {
  color: var(--muted);
  margin-top: 10px;
  margin-bottom: 14px;
}

.danger-btn {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
}

.photo-item {
  list-style: none;
  margin-bottom: 14px;
}

.photo-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.photo-preview {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  margin-bottom: 12px;
}

.photo-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.photo-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.photo-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.photo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 28px 20px 40px;
  border-top: 1px solid var(--line);
  background: rgba(11, 17, 32, 0.85);
}

.footer p {
  font-size: 0.98rem;
}

@media (min-width: 768px) {
  .header {
    padding: 40px 24px 20px;
  }

  .header h1 {
    font-size: 2.5rem;
  }

  .tagline {
    font-size: 1.05rem;
  }

  .search-bar {
    top: 110px;
  }

  .nav {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
    top: 176px;
  }

  main {
    padding: 32px 24px 90px;
  }

  .section {
    padding: 28px;
  }

  .folder-toolbar {
    grid-template-columns: 1fr 1.4fr;
    align-items: end;
  }
}

@media (max-width: 640px) {
  .header h1 {
    font-size: 1.8rem;
  }

  .search-bar {
    top: 91px;
  }

  .nav {
    top: 148px;
  }

  .list-item {
    flex-direction: column;
    align-items: stretch;
  }

  .list-item button,
  .list-actions button,
  .inline-row button,
  .list-actions select {
    width: 100%;
  }
}

/* ── Vault lock overlay ──────────────────────────────────────────────────────── */

.vault-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 40px 20px;
}

.vault-lock-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  width: 100%;
  max-width: 360px;
}

.vault-lock-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.vault-lock-box h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.vault-lock-box > p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.vault-pin-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 0.15em;
  margin-top: 0;
}

.vault-pin-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.vault-pin-error {
  color: var(--red);
  font-size: 0.85rem;
  min-height: 20px;
  margin-bottom: 12px;
}

.vault-lock-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vault-unlock-btn {
  background: linear-gradient(180deg, var(--accent) 0%, #0ea5e9 100%);
  color: #04111d;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 0;
}

.vault-unlock-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.vault-bio-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 0;
}

.vault-bio-btn:hover {
  background: var(--panel-2);
  transform: translateY(-1px);
}

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

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

.vault-status-unlocked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: color-mix(in srgb, #22c55e 15%, transparent);
  color: #22c55e;
  border: 1px solid color-mix(in srgb, #22c55e 40%, transparent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.vault-lock-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0;
}

.vault-lock-btn:hover {
  background: var(--panel-2);
  color: var(--text);
  transform: none;
}

.vault-bio-reg-btn {
  font-size: 0.88rem;
  padding: 8px 14px;
  margin-top: 0;
}
