/* ============================================================
   VaultLedger — skeuomorphic passbook / leather-ledger theme
   ============================================================ */

:root {
  /* Color tokens */
  --ink-navy: #1B2A3D;
  --ink-navy-deep: #121D2B;
  --brass: #B8935F;
  --brass-light: #D4B588;
  --brass-dark: #8A6B3F;
  --paper: #EFE6D5;
  --paper-warm: #E8DCC4;
  --paper-white: #F7F1E3;
  --burgundy: #6B2737;
  --burgundy-deep: #4E1B27;
  --forest: #3F5B45;
  --forest-deep: #2E4433;
  --ink-text: #2A2118;
  --ink-text-soft: #5C5142;

  --shadow-deep: 0 2px 6px rgba(18, 29, 43, 0.35), 0 10px 24px rgba(18, 29, 43, 0.25);
  --shadow-inset: inset 0 2px 4px rgba(0,0,0,0.25), inset 0 -1px 0 rgba(255,255,255,0.06);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", -apple-system, sans-serif;
  --font-mono: "Space Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink-text);
  background:
    radial-gradient(ellipse at top left, #24384f 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, #14202e 0%, transparent 55%),
    var(--ink-navy);
  background-attachment: fixed;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* subtle cloth/felt texture using layered gradients (no external images needed) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    repeating-linear-gradient(0deg, #fff 0px, transparent 1px, transparent 2px),
    repeating-linear-gradient(90deg, #fff 0px, transparent 1px, transparent 2px);
  z-index: 0;
}

/* ============ AUTH SCREEN ============ */

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

.auth-wrap {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  text-align: center;
  margin-bottom: 28px;
}

.brand-seal {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass-light), var(--brass) 55%, var(--brass-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink-navy-deep);
  box-shadow: var(--shadow-deep), inset 0 1px 1px rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.2);
}

.brand-seal.small {
  width: 34px;
  height: 34px;
  font-size: 14px;
  margin: 0;
}

.brand-mark h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 34px;
  letter-spacing: 0.01em;
  color: var(--paper-white);
  margin: 0 0 6px;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brass-light);
  letter-spacing: 0.04em;
  margin: 0;
  opacity: 0.85;
}

/* --- passbook object --- */

.passbook {
  position: relative;
  display: flex;
  background: linear-gradient(145deg, #3a2418, #2a1a10);
  border-radius: 10px;
  box-shadow: var(--shadow-deep);
  padding: 6px;
}

.passbook-spine {
  width: 18px;
  border-radius: 8px 0 0 8px;
  background:
    repeating-linear-gradient(180deg, rgba(0,0,0,0.35) 0 3px, rgba(0,0,0,0) 3px 9px),
    linear-gradient(90deg, #1e1108, #3a2418);
  box-shadow: inset -2px 0 4px rgba(0,0,0,0.5);
}

.passbook-inner {
  flex: 1;
  background: var(--paper);
  background-image:
    linear-gradient(var(--paper) , var(--paper)),
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(107, 39, 55, 0.08) 33px 34px);
  border-radius: 0 8px 8px 0;
  padding: 28px 28px 26px;
  box-shadow: var(--shadow-inset);
}

.tab-row {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--brass);
  padding-bottom: 0;
}

.tab-btn {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 8px;
  background: transparent;
  border: none;
  color: var(--ink-text-soft);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.2s ease, background 0.2s ease;
}

.tab-btn.active {
  color: var(--burgundy);
  background: var(--paper-white);
  box-shadow: 0 -2px 0 0 var(--brass) inset;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 6px;
}

.auth-form.active {
  display: flex;
}

.auth-form label,
.send-panel label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-text-soft);
  margin-top: 12px;
}

.auth-form label:first-of-type {
  margin-top: 0;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #c9bb9c;
  background: var(--paper-white);
  color: var(--ink-text);
  box-shadow: inset 0 2px 3px rgba(90, 70, 40, 0.15);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible {
  border-color: var(--burgundy);
  box-shadow: inset 0 2px 3px rgba(90, 70, 40, 0.15), 0 0 0 3px rgba(107, 39, 55, 0.18);
}

.form-hint {
  font-size: 12.5px;
  color: var(--forest-deep);
  margin: 10px 0 0;
}

.form-error {
  font-size: 13px;
  color: var(--burgundy);
  min-height: 16px;
  margin: 10px 0 0;
}

.form-success {
  font-size: 13px;
  color: var(--forest-deep);
  min-height: 16px;
  margin: 10px 0 0;
}

.btn-primary {
  margin-top: 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  color: var(--paper-white);
  background: linear-gradient(180deg, var(--burgundy), var(--burgundy-deep));
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 13px 20px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,0.3), 0 6px 14px rgba(75, 20, 30, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 rgba(0,0,0,0.3), 0 2px 6px rgba(75, 20, 30, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-seal {
  font-size: 13px;
}

.btn-ghost {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--paper-white);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 7px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.14);
}

/* ============ APP SCREEN ============ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
  border-bottom: 1px solid rgba(184, 147, 95, 0.25);
  position: relative;
  z-index: 1;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--paper-white);
  letter-spacing: 0.01em;
}

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

.header-username {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brass-light);
}

.app-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  position: relative;
  z-index: 1;
}

/* --- balance card: the signature skeuomorphic element --- */

.balance-card {
  position: relative;
  border-radius: 16px;
  padding: 30px 34px 26px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.05), transparent 40%),
    linear-gradient(155deg, #24384f, #16273a 55%, #10202f);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255,255,255,0.06);
  border: 1px solid rgba(184, 147, 95, 0.35);
  overflow: hidden;
  margin-bottom: 30px;
}

.balance-card-texture {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: repeating-linear-gradient(135deg, #fff 0 1px, transparent 1px 6px);
  pointer-events: none;
}

.balance-card-stitching {
  position: absolute;
  inset: 10px;
  border: 1.5px dashed rgba(184, 147, 95, 0.45);
  border-radius: 10px;
  pointer-events: none;
}

.balance-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--brass);
  opacity: 0.7;
}
.balance-corner.tl { top: 8px; left: 8px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0;}
.balance-corner.tr { top: 8px; right: 8px; border-left: none; border-bottom: none; border-radius: 0 4px 0 0;}
.balance-corner.bl { bottom: 8px; left: 8px; border-right: none; border-top: none; border-radius: 0 0 0 4px;}
.balance-corner.br { bottom: 8px; right: 8px; border-left: none; border-top: none; border-radius: 0 0 4px 0;}

.balance-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  position: relative;
  z-index: 1;
}

.balance-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brass-light);
}

.balance-account-id {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brass-light);
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.balance-figure {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 18px 0 10px;
}

.balance-currency {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--brass);
  line-height: 1;
  transform: translateY(-4px);
}

#balance-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 58px;
  color: var(--paper-white);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.balance-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.balance-holder {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--paper-white);
}

.balance-since {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: rgba(239, 230, 213, 0.55);
}

/* --- panels --- */

.panels-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}

@media (max-width: 760px) {
  .panels-row {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--paper);
  border-radius: 12px;
  padding: 22px 24px 26px;
  box-shadow: var(--shadow-deep);
  border: 1px solid rgba(184, 147, 95, 0.25);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--brass);
  padding-bottom: 10px;
  margin-bottom: 4px;
}

.panel-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--burgundy-deep);
  margin: 0;
}

.panel-icon {
  font-family: var(--font-mono);
  color: var(--brass-dark);
  font-size: 16px;
}

.send-panel form {
  display: flex;
  flex-direction: column;
}

.optional {
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.7;
}

/* --- history --- */

.history-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 420px;
  overflow-y: auto;
}

.history-empty {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink-text-soft);
  padding: 20px 4px;
  text-align: center;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-bottom: 1px solid rgba(90, 70, 40, 0.12);
}

.history-row:last-child {
  border-bottom: none;
}

.history-dir {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.history-dir.sent {
  background: rgba(107, 39, 55, 0.12);
  color: var(--burgundy);
}

.history-dir.received {
  background: rgba(63, 91, 69, 0.14);
  color: var(--forest-deep);
}

.history-detail {
  flex: 1;
  min-width: 0;
}

.history-party {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-note {
  font-size: 12px;
  color: var(--ink-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  text-align: right;
  flex-shrink: 0;
}

.history-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}

.history-amount.sent { color: var(--burgundy); }
.history-amount.received { color: var(--forest-deep); }

.history-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-text-soft);
  opacity: 0.75;
}

/* --- toast --- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--ink-navy-deep);
  color: var(--paper-white);
  border: 1px solid var(--brass);
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13.5px;
  box-shadow: var(--shadow-deep);
  z-index: 100;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  pointer-events: none;
}

.toast.error {
  border-color: var(--burgundy);
}

/* scrollbar styling for the history panel */
.history-list::-webkit-scrollbar {
  width: 8px;
}
.history-list::-webkit-scrollbar-thumb {
  background: var(--brass);
  border-radius: 4px;
}
.history-list::-webkit-scrollbar-track {
  background: transparent;
}
