/* cashcode.digital — minimal dark theme */

:root {
  --bg: #090627;
  --surface: #1c1c4c;
  --surface-2: #342f65;
  --border: #342f65;
  --ink: #ffffff;
  --ink-dim: #b3b2cf;
  --accent: #08e638;
  --accent-2: #04932d;
  --accent-ink: #090627;
  --error: #ef4343;
  --notice: #08e638;
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 64px 24px 96px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}

p { margin: 0 0 16px; color: var(--ink-dim); }
p:last-child { margin-bottom: 0; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

/* Forms */

form { margin: 0; }

label {
  display: block;
  margin-bottom: 16px;
  color: var(--ink-dim);
  font-size: 0.85rem;
}

label small {
  display: block;
  margin-top: 4px;
  color: var(--ink-dim);
  font-size: 0.75rem;
  opacity: 0.7;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
  transition: border-color 120ms ease, background 120ms ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

button {
  display: inline-block;
  min-height: 44px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
button:hover { opacity: 0.9; }

button.secondary {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--border);
}
button.secondary:hover { color: var(--ink); border-color: var(--ink-dim); }

/* Landing */

.brand {
  margin-bottom: 48px;
}

.brand h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.brand h1 .accent {
  color: var(--accent);
}

.cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.button {
  display: inline-block;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: 0;
}
.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
}
.button.primary:hover { opacity: 0.9; border-bottom: none; }

.small {
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin: 0;
}

/* Profile */

.profile {
  text-align: center;
  margin-bottom: 32px;
}

.profile h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}

.handle {
  color: var(--ink-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  margin: 0;
}

.handle a {
  margin-left: 4px;
  color: var(--accent);
}

.amount-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}

.amount-display {
  font-size: clamp(2rem, 8vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--ink);
  word-break: break-all;
}

.amount-display .currency {
  color: var(--ink-dim);
  margin-right: 6px;
  font-weight: 500;
}

.inputs {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
  text-align: left;
}

#qr {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}

#qr svg {
  width: min(80vw, 260px);
  height: auto;
  aspect-ratio: 1 / 1;
  background: white;
  border-radius: 8px;
  padding: 12px;
}

.hint {
  color: var(--ink-dim);
  font-size: 0.8rem;
  margin: 0 0 16px;
}

.iban-details {
  margin: 20px 0 0;
  text-align: center;
}

.iban-details summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 0.8rem;
  list-style: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.iban-details summary:hover {
  color: var(--ink);
  border-color: var(--ink-dim);
}
.iban-details summary::-webkit-details-marker { display: none; }
.iban-details summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 160ms ease;
}
.iban-details[open] summary::after {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.iban-details code {
  display: block;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.02em;
  word-break: break-all;
  text-align: center;
}

.share {
  color: var(--ink-dim);
  font-size: 0.8rem;
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  word-break: break-all;
}

.share code {
  color: var(--accent);
}

/* Messages */

.error, .notice {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.error  { background: rgba(248,113,113,0.08); color: var(--error); border: 1px solid rgba(248,113,113,0.25); }
.notice { background: rgba(52,211,153,0.08); color: var(--notice); border: 1px solid rgba(52,211,153,0.25); }

/* Edit page */

.logout {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Site footer */

.site-footer {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--ink-dim);
  font-size: 0.85rem;
}

.site-footer a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* FAQ */

.faq article {
  border-top: 1px solid var(--border);
  padding: 20px 0;
}
.faq article:last-child { border-bottom: 1px solid var(--border); }

.faq h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

.faq p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.faq code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.85em;
}

/* Fieldset */

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface);
}
fieldset legend {
  color: var(--ink-dim);
  padding: 0 8px;
  font-size: 0.85rem;
}

/* Landing-page sections */

.brand .lead {
  font-size: 1.1rem;
  color: var(--ink);
  margin: 0 0 8px;
}

.howto,
.usecases,
.why {
  margin-top: 56px;
}

.howto h2,
.usecases h2,
.why h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 20px;
  color: var(--ink);
}

.howto ol {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

.howto li {
  counter-increment: step;
  padding: 16px 0 16px 44px;
  position: relative;
  border-top: 1px solid var(--border);
}
.howto li:last-child { border-bottom: 1px solid var(--border); }

.howto li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 16px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.howto h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}

.howto p,
.usecases li,
.why p {
  font-size: 0.95rem;
  color: var(--ink-dim);
  margin: 0;
}

.howto code {
  background: var(--surface);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}

.usecases ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.usecases li {
  padding: 14px 0;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
.usecases li:last-child { border-bottom: 1px solid var(--border); }

.usecases strong {
  color: var(--ink);
  font-weight: 600;
}

.why {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 56px;
}
.why h2 { margin-top: 0; }
.why p { line-height: 1.6; }

/* The second CTA at the very bottom of the landing flow */
.cta + .howto { margin-top: 64px; }
section.cta:last-of-type { margin-top: 48px; }

/* Admin */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 0 0 32px;
}
.admin-stats > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.admin-stats dt {
  font-size: 0.75rem;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
}
.admin-stats dd {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
}

.admin-users h2 {
  font-size: 1rem;
  margin: 0 0 16px;
  color: var(--ink);
}

.admin-users table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-users th,
.admin-users td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-users th {
  font-weight: 600;
  color: var(--ink-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-users tr:last-child td { border-bottom: none; }
.admin-users a {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}
.row-actions form { display: inline; margin: 0; }
.row-actions button {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 8px;
}
.row-actions button.danger {
  color: var(--error);
  border-color: rgba(239, 67, 67, 0.4);
}
.row-actions button.danger:hover {
  color: #fff;
  background: rgba(239, 67, 67, 0.15);
  border-color: var(--error);
}

/* Mobile refinements (≤480px: most phones) */

@media (max-width: 480px) {
  .container {
    padding-top: 32px;
    padding-bottom: 64px;
  }

  .brand {
    margin-bottom: 32px;
  }

  .brand h1 {
    font-size: 1.75rem;
  }

  /* Stack CTAs full width so they're easy to tap */
  .cta {
    align-items: stretch;
  }
  .cta .button,
  .cta button {
    width: 100%;
    text-align: center;
  }

  .amount-card {
    padding: 20px 16px;
  }

  .iban-details code,
  .share {
    font-size: 0.8rem;
  }

  .site-footer nav {
    gap: 16px;
  }
}

/* Touch-device tweaks (no hover, coarse pointer) */
@media (hover: none) and (pointer: coarse) {
  a:hover { border-bottom-color: transparent; }
  button:hover { opacity: 1; }
}
