:root {
  --ink: #102a43;
  --ink-soft: #52677a;
  --cobalt: #2356d8;
  --cobalt-deep: #173ca1;
  --sky: #cde9ff;
  --mist: #eef5fa;
  --paper: #fbfdff;
  --coral: #ee765d;
  --danger: #c03d32;
  --success: #0b7b62;
  --line: #dbe6ee;
  --shadow: 0 28px 80px rgba(16, 42, 67, 0.12);
  --body-font: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
  --display-font: "Arial Narrow", "Aptos Display", "Segoe UI", sans-serif;
  --data-font: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--mist);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
label,
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #fff;
  color: var(--cobalt-deep);
  font-weight: 700;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 0.9fr) minmax(540px, 1.1fr);
}

.story-panel {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(36px, 5vw, 72px);
  background: var(--cobalt);
  color: #fff;
  isolation: isolate;
}

.story-panel::before {
  position: absolute;
  z-index: -1;
  top: 0;
  right: -31%;
  width: 72%;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.13);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 63px,
    rgba(255, 255, 255, 0.07) 64px,
    rgba(255, 255, 255, 0.07) 65px
  );
  content: "";
  transform: skewX(-9deg);
  transform-origin: top;
}

.story-panel::after {
  position: absolute;
  z-index: -1;
  right: -150px;
  bottom: -190px;
  width: 420px;
  height: 420px;
  border: 86px solid rgba(205, 233, 255, 0.09);
  border-radius: 50%;
  content: "";
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  font-family: var(--display-font);
  font-size: 25px;
  font-stretch: condensed;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  width: 27px;
  height: 27px;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 5px;
  border-radius: 50%;
  background: var(--sky);
}

.brand-mark span {
  display: block;
  border-radius: 1px;
  background: var(--cobalt-deep);
}

.brand-mark span:nth-child(1) { height: 7px; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 10px; }

.story-copy {
  max-width: 590px;
  margin-top: clamp(50px, 9vh, 110px);
}

.eyebrow {
  margin: 0 0 15px;
  color: inherit;
  font-family: var(--data-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-copy .eyebrow {
  color: var(--sky);
}

.story-copy h1 {
  max-width: 550px;
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(45px, 4.8vw, 76px);
  font-stretch: condensed;
  font-weight: 750;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.story-description {
  max-width: 450px;
  margin: 25px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 17px;
  line-height: 1.65;
}

.ledger-card {
  width: min(100%, 480px);
  margin: clamp(44px, 8vh, 88px) 0 28px auto;
  padding: 23px 25px 17px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 17px;
  background: rgba(13, 43, 121, 0.62);
  box-shadow: 0 24px 60px rgba(11, 33, 92, 0.25);
  backdrop-filter: blur(18px);
  transform: rotate(-1.2deg);
}

.ledger-heading,
.ledger-balance,
.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ledger-heading {
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--data-font);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ledger-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ledger-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #79e1bc;
  box-shadow: 0 0 0 4px rgba(121, 225, 188, 0.12);
}

.ledger-balance {
  align-items: flex-end;
  margin-top: 23px;
}

.ledger-balance span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.ledger-balance strong {
  font-family: var(--data-font);
  font-size: clamp(21px, 2.1vw, 28px);
  letter-spacing: -0.05em;
}

.ledger-rule {
  height: 1px;
  margin: 18px 0 4px;
  background: rgba(255, 255, 255, 0.13);
}

.ledger-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 11px;
  padding: 13px 0;
}

.entry-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  font-size: 15px;
}

.entry-icon.income { background: rgba(121, 225, 188, 0.16); color: #91f3cf; }
.entry-icon.expense { background: rgba(255, 177, 161, 0.14); color: #ffb1a1; }

.entry-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.entry-copy b,
.ledger-row > strong {
  font-size: 12px;
  font-weight: 650;
}

.entry-copy small {
  color: rgba(255, 255, 255, 0.47);
  font-size: 10px;
}

.ledger-row > strong {
  font-family: var(--data-font);
  letter-spacing: -0.04em;
}

.ledger-row .amount-in { color: #91f3cf; }

.privacy-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--data-font);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.privacy-note span { color: var(--sky); font-size: 8px; }

.form-panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: clamp(28px, 5vw, 72px) clamp(28px, 8vw, 130px) 25px;
  background: var(--paper);
}

.mobile-brand {
  display: none;
  color: var(--ink);
}

.form-wrap {
  width: min(100%, 470px);
  margin: auto;
  padding: 50px 0;
}

.form-intro .eyebrow {
  margin-bottom: 13px;
  color: var(--cobalt);
}

.form-intro h2 {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(36px, 3.4vw, 50px);
  font-stretch: condensed;
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 1.04;
}

.form-intro > p:last-child {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}

form {
  margin-top: 39px;
}

.field + .field {
  margin-top: 22px;
}

.field label,
.label-row {
  font-size: 13px;
  font-weight: 700;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.secure-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--success);
  font-family: var(--data-font);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.secure-label svg {
  width: 13px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.input-wrap {
  position: relative;
  margin-top: 9px;
}

.input-wrap > svg {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 20px;
  stroke: #72879a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  height: 55px;
  padding: 0 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-wrap input::placeholder { color: #9aa9b6; }

.input-wrap input:hover { border-color: #b6c9d7; }

.input-wrap input:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 4px rgba(35, 86, 216, 0.1);
}

.field.has-error .input-wrap input {
  border-color: var(--danger);
  background: #fffafa;
}

.field.has-error .input-wrap input:focus {
  box-shadow: 0 0 0 4px rgba(192, 61, 50, 0.09);
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #657d90;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover { background: var(--mist); color: var(--cobalt); }
.password-toggle:focus-visible { outline: 3px solid rgba(35, 86, 216, 0.25); }
.password-toggle svg { width: 20px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }

.field-error,
.caps-warning {
  min-height: 0;
  margin: 6px 2px 0;
  color: var(--danger);
  font-size: 12px;
}

.field-error:empty,
.caps-warning:empty { display: none; }
.caps-warning { color: #916414; }

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}

.check-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.custom-check {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #afc2d0;
  border-radius: 5px;
  background: #fff;
}

.custom-check svg {
  display: none;
  width: 11px;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.check-label input:checked + .custom-check {
  border-color: var(--cobalt);
  background: var(--cobalt);
}

.check-label input:checked + .custom-check svg { display: block; }
.check-label input:focus-visible + .custom-check { box-shadow: 0 0 0 4px rgba(35, 86, 216, 0.12); }

.help-text {
  color: #7b8e9f;
  font-size: 11px;
  text-align: right;
}

.form-alert {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid #f0c5bf;
  border-radius: 9px;
  background: #fff5f3;
  color: #8f3129;
  font-size: 13px;
  line-height: 1.45;
}

.submit-button {
  position: relative;
  display: flex;
  width: 100%;
  height: 56px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-top: 28px;
  overflow: hidden;
  border: 0;
  border-radius: 11px;
  background: var(--cobalt);
  box-shadow: 0 13px 28px rgba(35, 86, 216, 0.23);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.submit-button::before {
  position: absolute;
  top: 0;
  left: -40%;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  content: "";
  transform: skewX(-20deg);
  transition: left 420ms ease;
}

.submit-button:hover {
  background: var(--cobalt-deep);
  box-shadow: 0 16px 32px rgba(35, 86, 216, 0.29);
  transform: translateY(-1px);
}

.submit-button:hover::before { left: 115%; }
.submit-button:active { transform: translateY(0); }
.submit-button:focus-visible { outline: 4px solid rgba(35, 86, 216, 0.22); outline-offset: 3px; }
.submit-button:disabled { cursor: wait; opacity: 0.76; transform: none; }
.button-arrow { font-size: 20px; line-height: 1; transition: transform 160ms ease; }
.submit-button:hover .button-arrow { transform: translateX(3px); }

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

.submit-button.is-loading .button-label,
.submit-button.is-loading .button-arrow { display: none; }
.submit-button.is-loading .spinner { display: block; }

.security-footnote {
  display: flex;
  gap: 12px;
  margin-top: 31px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.shield {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: #e9f6f2;
  color: var(--success);
}

.shield svg { width: 18px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.security-footnote p {
  margin: 0;
  color: #7b8e9f;
  font-size: 11px;
  line-height: 1.55;
}

.security-footnote strong { color: var(--ink-soft); font-weight: 700; }

.form-panel footer {
  margin-top: auto;
  color: #91a0ad;
  font-family: var(--data-font);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

@keyframes spin { to { transform: rotate(360deg); } }

.placeholder-dashboard {
  min-height: 100vh;
  padding: clamp(28px, 7vw, 100px);
  background: var(--mist);
}

.placeholder-dashboard .brand { color: var(--ink); }
.placeholder-dashboard section { max-width: 650px; margin: 15vh auto 0; }
.placeholder-dashboard .eyebrow { color: var(--cobalt); }
.placeholder-dashboard h1 {
  margin: 0 0 18px;
  font-family: var(--display-font);
  font-size: clamp(52px, 9vw, 100px);
  font-stretch: condensed;
  font-weight: 750;
  letter-spacing: -0.07em;
  line-height: 0.95;
}
.placeholder-dashboard p { color: var(--ink-soft); line-height: 1.7; }
.placeholder-dashboard .logout-button { width: 150px; margin-top: 32px; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 0.85fr 1.15fr; }
  .story-panel { padding: 40px; }
  .story-copy h1 { font-size: 52px; }
  .ledger-card { padding: 19px; }
  .ledger-balance { display: block; }
  .ledger-balance strong { display: block; margin-top: 5px; }
  .form-panel { padding-inline: 55px; }
}

@media (max-width: 760px) {
  .login-shell { display: block; }
  .story-panel { display: none; }
  .form-panel {
    min-height: 100svh;
    padding: 28px clamp(22px, 7vw, 54px) 22px;
    background:
      linear-gradient(160deg, rgba(205, 233, 255, 0.5), transparent 26%),
      var(--paper);
  }
  .mobile-brand { display: inline-flex; }
  .form-wrap { padding: clamp(55px, 11vh, 95px) 0 48px; }
  .form-panel footer { padding-top: 24px; }
}

@media (max-width: 430px) {
  .form-intro h2 { font-size: 36px; }
  .form-options { align-items: flex-start; }
  .help-text { max-width: 150px; }
  .security-footnote { margin-top: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
