/* =====================================================================
   Household Ledger — Design tokens & shared styles
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Public+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  /* Color */
  --paper:        #EEF1EA;
  --paper-raised: #FBFCF9;
  --rule:         #C4CFBE;
  --rule-soft:    #DCE3D6;
  --ink:          #1C2321;
  --ink-soft:     #4A5550;
  --ink-faint:    #7C8880;
  --brass:        #A1782F;
  --brass-deep:   #7E5F25;
  --brass-tint:   #F1E6D2;
  --red-ink:      #9C3B2E;
  --red-tint:     #F3E3DF;
  --green-ink:    #2E6B4F;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  /* Layout */
  --radius: 3px;
  --shadow-card: 0 1px 2px rgba(28,35,33,0.06), 0 10px 30px -12px rgba(28,35,33,0.18);
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  background-image:
    linear-gradient(var(--paper) 0%, var(--paper) 100%),
    repeating-linear-gradient(
      transparent, transparent 27px,
      var(--rule-soft) 27px, var(--rule-soft) 28px
    );
  font-family: var(--font-body);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px;
}

/* ---------------------------------------------------------------------
   Brand mark
   --------------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 40px;
  text-decoration: none;
  color: var(--ink);
}

.brand__mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.brand__tick {
  width: 7px;
  height: 7px;
  background: var(--brass);
  border-radius: 1px;
  transform: rotate(45deg);
}

/* ---------------------------------------------------------------------
   Ledger card — the signature element
   --------------------------------------------------------------------- */

.ledger-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 44px 40px 40px 64px;
  clip-path: polygon(
    0% 5%, 3.5% 0%, 7% 5%, 10.5% 0%, 14% 5%, 17.5% 0%, 21% 5%, 24.5% 0%,
    28% 5%, 31.5% 0%, 35% 5%, 38.5% 0%, 42% 5%, 45.5% 0%, 49% 5%, 52.5% 0%,
    56% 5%, 59.5% 0%, 63% 5%, 66.5% 0%, 70% 5%, 73.5% 0%, 77% 5%, 80.5% 0%,
    84% 5%, 87.5% 0%, 91% 5%, 94.5% 0%, 98% 5%, 100% 2%,
    100% 100%, 0% 100%
  );
}

.ledger-card::before {
  /* red margin rule */
  content: '';
  position: absolute;
  top: 24px;
  bottom: 0;
  left: 40px;
  width: 1px;
  background: var(--red-ink);
  opacity: 0.35;
}

.ledger-card::after {
  /* punch holes, like a checkbook stub */
  content: '';
  position: absolute;
  top: 40px;
  bottom: 24px;
  left: 18px;
  width: 6px;
  background-image: radial-gradient(circle, var(--paper) 2.6px, transparent 2.7px);
  background-size: 6px 30px;
  background-repeat: repeat-y;
  box-shadow: inset 0 0 0 1px var(--rule);
  border-radius: 3px;
}

.ledger-card__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 6px;
}

.ledger-card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 8px;
  color: var(--ink);
}

.ledger-card p.lede {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 28px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
   Form elements
   --------------------------------------------------------------------- */

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.field-row {
  display: flex;
  gap: 12px;
}
.field-row .field { flex: 1; }

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field input::placeholder { color: var(--ink-faint); }

.field input:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-tint);
}

.field input.has-error {
  border-color: var(--red-ink);
}
.field input.has-error:focus {
  box-shadow: 0 0 0 3px var(--red-tint);
}

.field-error {
  display: none;
  font-size: 12.5px;
  color: var(--red-ink);
  margin-top: 6px;
}
.field-error.visible { display: block; }

.field-hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
}

/* password strength */
.strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.strength__bar {
  height: 3px;
  flex: 1;
  background: var(--rule);
  border-radius: 2px;
  transition: background 150ms ease;
}
.strength__bar.weak { background: var(--red-ink); }
.strength__bar.fair { background: var(--brass); }
.strength__bar.strong { background: var(--green-ink); }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 120ms ease, transform 60ms ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper-raised);
}
.btn-primary:hover { background: #303a37; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled {
  background: var(--ink-faint);
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.btn-ghost:hover { border-color: var(--brass); color: var(--ink); }

/* ---------------------------------------------------------------------
   Footnote / cross-links
   --------------------------------------------------------------------- */

.card-footnote {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: center;
}
.card-footnote a {
  color: var(--brass-deep);
  font-weight: 600;
  text-decoration: none;
}
.card-footnote a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   Status banner (top of card, e.g. server errors)
   --------------------------------------------------------------------- */

.banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 22px;
}
.banner.visible { display: flex; }
.banner-error {
  background: var(--red-tint);
  color: var(--red-ink);
  border: 1px solid rgba(156,59,46,0.25);
}
.banner-success {
  background: #E5EFE9;
  color: var(--green-ink);
  border: 1px solid rgba(46,107,79,0.25);
}

/* ---------------------------------------------------------------------
   MFA — digit entry (tabular, ledger-column feel)
   --------------------------------------------------------------------- */

.otp-row {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

.otp-digit {
  width: 44px;
  height: 54px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-bottom: 2px solid var(--rule);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.otp-digit:focus {
  border-color: var(--brass);
  border-bottom-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-tint);
}
.otp-digit.has-error {
  border-color: var(--red-ink);
  border-bottom-color: var(--red-ink);
}

.mfa-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: -6px;
  margin-bottom: 24px;
}
.mfa-meta button {
  background: none;
  border: none;
  padding: 0;
  color: var(--brass-deep);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
}
.mfa-meta button:disabled {
  color: var(--ink-faint);
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------
   Icon check for empty/success states
   --------------------------------------------------------------------- */

.envelope {
  width: 52px;
  height: 40px;
  margin: 4px 0 22px;
  border: 1.5px solid var(--brass);
  border-radius: 3px;
  position: relative;
  background: var(--brass-tint);
}
.envelope::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 0; height: 0;
  border-left: 26px solid transparent;
  border-right: 26px solid transparent;
  border-top: 18px solid var(--paper-raised);
}

@media (max-width: 480px) {
  .ledger-card { padding: 40px 24px 32px 48px; }
  .ledger-card::before { left: 26px; }
  .ledger-card::after { left: 10px; }
  .otp-digit { width: 38px; height: 48px; font-size: 19px; }
}
