/* Sign-in page. Builds on the tokens in styles.css. */
.login {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 480px);
  min-height: 100vh;
}

/* ---------- Left: decorative desk ---------- */
.login-art {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 40px 40px;
  overflow: hidden;
  background-color: var(--paper-2);
  background-image: repeating-linear-gradient(to bottom, transparent 0 53px, var(--paper-3) 53px 54px);
  border-right: 1px solid var(--line);
}
/* Desk of tool cards: each drops in, drifts on its own loop, and a cursor makes the rounds */
.desk {
  position: relative;
  width: min(100%, 560px);
  height: 380px;
  margin: auto 0 0;
}
.desk-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 9px;
  background: var(--card);
  border: 1px solid var(--ink-2);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 16px 34px rgba(28, 27, 31, .16), 0 2px 6px rgba(28, 27, 31, .08);
  transform: rotate(var(--r));
  animation: desk-in .7s cubic-bezier(.2, .8, .2, 1.1) var(--d) both,
             desk-float 7s ease-in-out calc(var(--d) + .7s) infinite;
}
/* Focus ring flashes when the cursor "clicks" this card */
.desk-card::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  animation: card-focus 12s ease-out var(--fd) infinite;
}
.desk-card b { font-size: 12px; font-weight: 600; }
.desk-card .cap { font-size: 8px; letter-spacing: .12em; }
.desk-card svg { color: var(--ink); }
.rp { margin-right: 6px; font-family: var(--mono); font-size: 11px; font-style: normal; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); }

.dc-finance { left: 0; top: 44px; width: 256px; padding: 12px 14px; z-index: 3; }
.dc-balance { display: flex; align-items: flex-start; margin: 6px 0 4px; min-height: 28px; color: var(--ink); }
.dc-balance .rp { margin-top: 1px; }
.dc-bars { display: flex; flex-direction: column; gap: 4px; }
.dc-bars i { display: block; height: 4px; width: var(--w); background: var(--paper-3); transform-origin: left; animation: bar-grow 1.1s ease-out calc(var(--d) + .5s) both, bar-breathe 5s ease-in-out 2s infinite; }
.dc-bars i:nth-child(2) { background: var(--accent); animation-delay: calc(var(--d) + .65s), 2.6s; }
.dc-bars i:nth-child(3) { animation-delay: calc(var(--d) + .8s), 3.2s; }
.dc-tx {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-2);
}
.dc-tx .in { color: var(--accent); font-weight: 700; }
.dc-tx .out { color: var(--ink); font-weight: 700; }
.dc-tx.swap-in { animation: tx-in .45s ease-out; }

.desk-chip {
  position: absolute;
  left: 176px;
  top: 14px;
  z-index: 4;
  padding: 4px 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  opacity: 0;
  box-shadow: 0 8px 18px rgba(107, 77, 230, .3);
}
.desk-chip.is-out { background: var(--ink); box-shadow: 0 8px 18px rgba(28, 27, 31, .25); }
.desk-chip.pop { animation: chip-pop 1.8s ease-out; }

.dc-docs { right: 48px; top: 10px; width: 150px; z-index: 2; animation-duration: .7s, 8s; }
.dc-sheet {
  position: absolute;
  right: 44px;
  top: 16px;
  width: 140px;
  height: 92px;
  background: var(--paper);
  border: 1px solid var(--line);
  transform: rotate(var(--r));
  animation: sheet-peek 5s ease-in-out 1.6s infinite both;
}
.dc-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  padding: 2px 6px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  animation: badge-pulse 2.4s ease-in-out 1.5s infinite;
}
.dc-lines { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.dc-lines i { display: block; height: 2px; background: var(--line); transform-origin: left; animation: line-type 4s steps(6) infinite; }
.dc-lines i:nth-child(2) { width: 80%; animation-delay: .5s; }
.dc-lines i:nth-child(3) { width: 55%; animation-delay: 1s; }

.dc-pdf { left: 84px; bottom: 16px; width: 176px; animation-duration: .7s, 6.5s; }
.dc-pages { position: relative; height: 26px; margin-bottom: 2px; }
.dc-pages i { position: absolute; top: 0; width: 18px; height: 24px; background: var(--paper); border: 1px solid var(--ink-2); animation: page-fan 4s ease-in-out infinite; }
.dc-pages i:nth-child(1) { left: 0; --i: 0; }
.dc-pages i:nth-child(2) { left: 6px; --i: 2; animation-delay: -.3s; }
.dc-pages i:nth-child(3) { left: 12px; --i: 4; background: var(--accent-soft); border-color: var(--accent); animation-delay: -.6s; }
.dc-progress { display: block; height: 4px; margin-top: 4px; background: var(--paper-3); }
.dc-progress i { display: block; height: 100%; background: var(--ink); transform-origin: left; animation: progress 4s cubic-bezier(.6, 0, .3, 1) 1.2s infinite both; }

.dc-vault { right: 16px; bottom: 76px; width: 140px; background: var(--ink); border-color: var(--ink); color: var(--card); animation-duration: .7s, 7.5s; }
.dc-vault svg { color: var(--card); overflow: visible; }
.dc-vault .shackle { animation: shackle 3.6s ease-in-out 1.4s infinite; }
.dc-dots { display: flex; gap: 4px; margin-top: 2px; }
.dc-dots i { width: 6px; height: 6px; background: #b9a8f1; opacity: .2; animation: pin 3.6s steps(1) infinite; }
.dc-dots i:nth-child(2) { animation-delay: .15s; }
.dc-dots i:nth-child(3) { animation-delay: .3s; }
.dc-dots i:nth-child(4) { animation-delay: .45s; }
.dc-dots i:nth-child(5) { animation-delay: .6s; }
.dc-dots i:nth-child(6) { animation-delay: .75s; }

.spark { position: absolute; width: 12px; height: 12px; opacity: 0; animation: spark 4.5s ease-in-out var(--sd) infinite; }
.spark::before, .spark::after { content: ''; position: absolute; background: var(--accent); }
.spark::before { left: 4px; top: 0; width: 4px; height: 12px; }
.spark::after { left: 0; top: 4px; width: 12px; height: 4px; }

.desk-cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  filter: drop-shadow(0 3px 4px rgba(28, 27, 31, .25));
  animation: cursor-tour 12s ease-in-out 1.5s infinite both;
}

@keyframes desk-in {
  from { opacity: 0; transform: translateY(26px) rotate(calc(var(--r) * -2)); }
  to { opacity: 1; transform: translateY(0) rotate(var(--r)); }
}
@keyframes desk-float {
  0%, 100% { transform: translateY(0) rotate(var(--r)); }
  50% { transform: translateY(-8px) rotate(calc(var(--r) + 1.2deg)); }
}
@keyframes card-focus {
  0%, 8% { opacity: 0; transform: scale(1.04); }
  10% { opacity: 1; transform: scale(1); }
  18%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes cursor-tour {
  0%, 12% { transform: translate(170px, 120px); }
  22%, 37% { transform: translate(450px, 70px); }
  47%, 62% { transform: translate(470px, 265px); }
  72%, 87% { transform: translate(190px, 315px); }
  100% { transform: translate(170px, 120px); }
}
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bar-breathe { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.7); } }
@keyframes tx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes chip-pop {
  0% { opacity: 0; transform: translateY(10px) scale(.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.06); }
  25%, 70% { opacity: 1; transform: translateY(-2px) scale(1); }
  100% { opacity: 0; transform: translateY(-18px) scale(.95); }
}
@keyframes sheet-peek {
  0%, 30%, 100% { transform: translate(0, 0) rotate(var(--r)); }
  55%, 75% { transform: translate(26px, 18px) rotate(calc(var(--r) + 6deg)); }
}
@keyframes badge-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
@keyframes line-type { 0% { transform: scaleX(0); } 60%, 100% { transform: scaleX(1); } }
@keyframes page-fan {
  0%, 100% { transform: translateX(0) rotate(0); }
  50% { transform: translateX(calc(var(--i) * 4px)) rotate(4deg); }
}
@keyframes progress { 0% { transform: scaleX(0); } 70%, 90% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes shackle { 0%, 55%, 100% { transform: translateY(0); } 65%, 85% { transform: translateY(-2.5px); } }
@keyframes pin { 0% { opacity: .2; } 10%, 80% { opacity: 1; } 90%, 100% { opacity: .2; } }
@keyframes spark {
  0%, 100% { opacity: 0; transform: scale(.2) rotate(0); }
  20%, 40% { opacity: 1; transform: scale(1) rotate(90deg); }
  60% { opacity: 0; transform: scale(.4) rotate(180deg); }
}

.art-copy { margin: 26px 0 auto; }
.art-line {
  max-width: 20ch;
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.025em;
}
.swap {
  display: inline-block;
  padding: 0 6px;
  background: var(--accent-soft);
  border-bottom: 3px solid var(--accent);
  color: var(--accent);
  overflow: hidden;
  vertical-align: bottom;
}
.swap span { display: inline-block; }
.swap span.out { animation: word-out .25s ease-in forwards; }
.swap span.in { animation: word-in .3s ease-out; }
@keyframes word-out { to { opacity: 0; transform: translateY(-100%); } }
@keyframes word-in { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }
.art-sub { max-width: 52ch; margin: 12px 0 0; font-size: 9px; line-height: 1.7; color: var(--ink-2); }

.desk-tag {
  position: absolute;
  right: 40px;
  bottom: 36px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  transform: rotate(3deg);
  box-shadow: 0 6px 14px rgba(28, 27, 31, .08);
  --r: 3deg;
  animation: desk-in .7s ease-out 1s both, desk-float 6s ease-in-out 1.7s infinite;
}
.desk-tag .cap { font-size: 8px; }
.tag-price { display: flex; align-items: flex-start; color: var(--ink); }
.tag-price .rp { margin-top: 2px; }

/* ---------- Right: form ---------- */
.login-panel {
  display: flex;
  align-items: center;
  padding: 40px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 53px, var(--rule) 53px 54px);
}
.login-form { width: 100%; max-width: 360px; margin: 0 auto; }
.login-form .ph { margin-bottom: 10px; }
.login-lede { margin: 0 0 22px; font-size: 12px; color: var(--ink-2); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--ink); }
.input-wrap { position: relative; }
.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.field input::placeholder { color: var(--muted); }
.field input:hover { border-color: var(--ink-2); border-bottom-color: var(--ink); }
.field input:focus { outline: none; background: #fff; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-wrap input { padding-right: 64px; }
.reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 5px 8px;
  background: none;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
}
.reveal:hover { color: var(--ink); border-color: var(--line); }

.field-error {
  margin: 6px 0 0;
  min-height: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
}
.field-error:empty { display: none; }
.field.is-invalid input { border-color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-soft); }

.submit {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  background: var(--ink);
  color: #fff;
  border: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s;
}
.submit:hover { background: #333238; }
.submit:active { transform: translateY(1px); }

.form-status {
  margin: 16px 0 0;
  padding: 10px 14px;
  background: var(--paper-2);
  border-left: 3px solid var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
}

.login-legal { margin: 18px 0 0; font-size: 11px; line-height: 1.6; color: var(--ink-2); }
.login-legal a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 2px; }

.form-status.is-error { background: var(--accent-soft); border-left-color: var(--accent); color: var(--ink); }
.submit:disabled { background: var(--paper-3); color: var(--muted); cursor: wait; }

.setup-steps { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.setup-steps li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.setup-steps li:last-child { border-bottom: 0; }
.setup-steps b { color: var(--ink); font-weight: 600; }
.setup-steps code { padding: 1px 5px; background: var(--paper-3); font-family: var(--mono); font-size: 11px; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .desk-card, .desk-card::after, .desk-tag, .desk-cursor, .spark, .dc-sheet, .dc-badge,
  .dc-bars i, .dc-lines i, .dc-pages i, .dc-progress i, .dc-dots i, .dc-vault .shackle { animation: none; }
  .desk-cursor, .spark { display: none; }
  .dc-dots i { opacity: 1; }
}

/* Small screens: the desk becomes a compact hero above the form */
@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding: 20px 16px 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  /* Brand is unzoomed, so its margin keeps the desk clear of the tag at any desk zoom */
  .login-art .brand { display: block; margin-bottom: 48px; }
  .desk { margin: 0 auto; }
  .art-copy { margin: 18px 0 0; }
  .art-line { font-size: 24px; }
  .desk-tag { top: 14px; right: 16px; bottom: auto; zoom: .72; }
  .login-panel { align-items: flex-start; padding: 32px 16px 48px; }
}
@media (max-width: 620px) { .desk { zoom: .8; } }
@media (max-width: 480px) {
  .desk { zoom: .6; }
  .art-line { font-size: 21px; }
}
@media (max-width: 370px) { .desk { zoom: .52; } }
