/* =========================================================================
   DUAL · auth + account — forms, validation, split-screen layout,
                           account dashboard, toast.
   Reuses tokens.css and the base type/color/motion system. No new aesthetic.
   ========================================================================= */

/* ============ SHARED FORM CONTROLS ============ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
}

.field__label {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-600);
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--ink-400);
}

.input,
.textarea {
  width: 100%;
  height: 48px;
  padding: 0 var(--s-4);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--ink-900);
  font: inherit;
  font-size: var(--fs-base);
  transition:
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out);
}
.textarea { height: auto; padding: var(--s-3) var(--s-4); min-height: 96px; resize: vertical; }

.input:hover, .textarea:hover { border-color: var(--ink-400); }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue-700);
  box-shadow: 0 0 0 4px rgba(62, 64, 149, 0.10);
  background: #fff;
}

.field[data-state="error"] .input,
.field[data-state="error"] .textarea {
  border-color: var(--red-600);
  box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.08);
}

.field__error {
  display: none;
  font-size: var(--fs-xs);
  color: var(--red-600);
  letter-spacing: 0.01em;
  padding-left: 2px;
  align-items: center;
  gap: 6px;
}
.field__error::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: var(--r-full);
  background: var(--red-600);
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 700;
}
.field[data-state="error"] .field__error { display: inline-flex; }

/* Password reveal */
.field--password { position: relative; }
.field--password .input { padding-right: 48px; }
.field__reveal {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 36px; height: 36px;
  border-radius: var(--r-2);
  color: var(--ink-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.field__reveal:hover { background: var(--bg-tint); color: var(--ink-900); }
.field__reveal svg { width: 18px; height: 18px; }

/* Checkbox row */
.checkbox-row {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--s-3);
  font-size: var(--fs-sm);
  color: var(--ink-700);
  line-height: 1.5;
  cursor: pointer;
}
.checkbox-row input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-row .box {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: var(--r-1);
  border: 1.5px solid var(--ink-400);
  background: #fff;
  position: relative;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.checkbox-row input:checked + .box {
  background: var(--ink-900);
  border-color: var(--ink-900);
}
.checkbox-row input:checked + .box::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-row input:focus-visible + .box {
  outline: 2px solid var(--red-500);
  outline-offset: 2px;
}
.checkbox-row a { color: var(--blue-700); border-bottom: 1px solid currentColor; }

/* Form row helpers */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
}
.form-grid {
  display: grid;
  gap: var(--s-4);
}
.form-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) {
  .form-grid--2 { grid-template-columns: 1fr; }
}

.btn--full { width: 100%; }

/* Form-level banner (server-style errors) */
.form-banner {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-2);
  font-size: var(--fs-sm);
  display: none;
  align-items: flex-start;
  gap: var(--s-3);
  line-height: 1.45;
}
.form-banner[data-state="error"] {
  display: flex;
  background: rgba(227, 6, 19, 0.06);
  border: 1px solid rgba(227, 6, 19, 0.18);
  color: #8E0009;
}
.form-banner[data-state="success"] {
  display: flex;
  background: rgba(37, 194, 107, 0.07);
  border: 1px solid rgba(37, 194, 107, 0.22);
  color: #136a3a;
}

/* ============ SPLIT-SCREEN AUTH LAYOUT ============ */

.auth {
  min-height: calc(var(--vh, 1vh) * 100);
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
}

.auth__brand {
  position: relative;
  background: var(--ink-900);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: var(--s-7) var(--s-9);
}
@media (max-width: 960px) {
  .auth__brand {
    padding: var(--s-5) var(--gutter) var(--s-6);
    min-height: 200px;
  }
}

.auth__brand-logo img {
  height: 36px;
  filter: brightness(0) invert(1);
}

.auth__brand-mid {
  margin: auto 0;
  max-width: 36ch;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
@media (max-width: 960px) {
  .auth__brand-mid { margin: var(--s-5) 0 0; max-width: 100%; }
}

.auth__brand-eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blue-200);
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
}
.auth__brand-eyebrow::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--blue-200);
}

.auth__brand-h {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: clamp(2rem, 1.5rem + 2vw, 3.5rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: #fff;
}
@media (max-width: 960px) {
  .auth__brand-h { font-size: clamp(1.5rem, 4vw, 2rem); }
}

.auth__brand-foot {
  margin-top: var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}
@media (max-width: 960px) {
  .auth__brand-foot { display: none; }
}

/* Signal-wave SVG over the brand panel */
.auth__signal {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
  opacity: 0.7;
  pointer-events: none;
}
.auth__signal path { fill: none; stroke-linecap: round; }

/* Right side: form panel */
.auth__form-wrap {
  padding: var(--s-9) var(--s-7);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 960px) {
  .auth__form-wrap { padding: var(--s-7) var(--gutter); }
}

.auth__form {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.auth__form-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.auth__form-eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-700);
}
.auth__form-h {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-3xl);
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink-900);
}
.auth__form-sub {
  color: var(--ink-600);
  font-size: var(--fs-base);
}

.auth__alt {
  margin-top: var(--s-3);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--ink-600);
}
.auth__alt a {
  font-family: var(--ff-display);
  font-weight: 600;
  color: var(--ink-900);
  border-bottom: 1px solid var(--ink-900);
  margin-left: 4px;
}

.auth__back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-600);
  position: absolute;
  top: var(--s-5);
  right: var(--s-7);
  transition: color var(--t-fast) var(--ease-out);
}
.auth__back:hover { color: var(--ink-900); }
@media (max-width: 960px) {
  .auth__back { top: var(--s-4); right: var(--gutter); color: rgba(255,255,255,0.8); }
  .auth__back:hover { color: #fff; }
}

.forgot-link {
  font-size: var(--fs-sm);
  color: var(--ink-700);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.forgot-link:hover { color: var(--ink-900); border-bottom-color: currentColor; }

/* ============ ACCOUNT DASHBOARD ============ */

.account {
  padding-block: clamp(2.5rem, 2rem + 3vw, 5rem);
  padding-top: calc(var(--nav-h-compact) + clamp(2rem, 1rem + 3vw, 4rem));
  min-height: calc(var(--vh, 1vh) * 100);
  background: var(--bg-tint);
}

.account__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}
.account__greet {
  display: flex; flex-direction: column; gap: var(--s-1);
}
.account__greet-eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-700);
}
.account__greet-h {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-3xl);
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink-900);
}
.account__signout {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-600);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-2);
  border: 1px solid var(--line);
  background: #fff;
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.account__signout:hover {
  color: var(--red-600);
  border-color: var(--red-600);
}

.account__grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 880px) {
  .account__grid { grid-template-columns: 1fr; }
}

/* Sidebar */
.account__nav {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--s-3);
  position: sticky;
  top: calc(var(--nav-h-compact) + var(--s-5));
}
@media (max-width: 880px) {
  .account__nav { position: static; }
}
.account__nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
@media (max-width: 880px) {
  .account__nav ul { flex-direction: row; flex-wrap: wrap; gap: 4px; }
}
.account__nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r-2);
  color: var(--ink-700);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.account__nav button:hover {
  background: var(--bg-tint);
  color: var(--ink-900);
}
.account__nav button[aria-selected="true"] {
  background: var(--ink-900);
  color: #fff;
}
.account__nav button[aria-selected="true"] .account__nav-ic {
  color: #fff;
}
.account__nav-ic {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--blue-700);
  transition: color var(--t-fast) var(--ease-out);
}
.account__nav-ic svg { width: 16px; height: 16px; }

.account__nav-divider {
  height: 1px;
  background: var(--line);
  margin: var(--s-2) var(--s-3);
}
@media (max-width: 880px) { .account__nav-divider { display: none; } }

/* Content panel */
.account__panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--s-7);
  min-height: 420px;
}
@media (max-width: 600px) {
  .account__panel { padding: var(--s-5); }
}

.account__panel-head {
  margin-bottom: var(--s-6);
}
.account__panel-eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-700);
  margin-bottom: var(--s-2);
}
.account__panel-h {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-2xl);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink-900);
}
.account__panel-sub {
  margin-top: var(--s-3);
  color: var(--ink-600);
  font-size: var(--fs-base);
  max-width: 60ch;
}

.tab-panel {
  display: none;
  animation: tab-fade 280ms var(--ease-out);
}
.tab-panel.is-active { display: block; }
@keyframes tab-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard quick-link grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
  margin-top: var(--s-5);
}
@media (max-width: 560px) { .quick-grid { grid-template-columns: 1fr; } }
.quick-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--bg-tint);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  text-align: left;
}
.quick-card:hover {
  border-color: var(--blue-400);
  background: #fff;
  transform: translateY(-2px);
}
.quick-card__ic {
  width: 32px; height: 32px;
  border-radius: var(--r-2);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--signal);
  color: #fff;
}
.quick-card__ic svg { width: 16px; height: 16px; }
.quick-card__h {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-base);
  letter-spacing: -0.01em;
  color: var(--ink-900);
}
.quick-card__sub { font-size: var(--fs-xs); color: var(--ink-600); }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s-9) var(--s-5);
  background: var(--bg-tint);
  border: 1px dashed var(--line);
  border-radius: var(--r-3);
}
.empty-state__ic {
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--blue-700);
  margin-bottom: var(--s-4);
  border: 1px solid var(--line);
}
.empty-state__ic svg { width: 24px; height: 24px; }
.empty-state__h {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  color: var(--ink-900);
  margin-bottom: var(--s-2);
}
.empty-state__sub {
  font-size: var(--fs-sm);
  color: var(--ink-600);
  margin-bottom: var(--s-5);
  max-width: 44ch;
}

/* Orders table — markup ready for future rows */
.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.orders-table th,
.orders-table td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}
.orders-table th {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-700);
  background: var(--bg-tint);
}

/* Address blocks */
.address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
}
@media (max-width: 760px) { .address-grid { grid-template-columns: 1fr; } }

.address-block {
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--s-5);
  background: var(--bg-tint);
}
.address-block h3 {
  font-size: var(--fs-base);
  margin-bottom: var(--s-4);
}
.address-block form {
  display: flex; flex-direction: column; gap: var(--s-4);
}

/* Downloads list */
.downloads-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  overflow: hidden;
}
.downloads-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.downloads-list li:last-child { border-bottom: 0; }
.downloads-list .mono { color: var(--ink-400); }

/* ============ TOAST ============ */

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: var(--s-3) var(--s-5);
  background: var(--ink-900);
  color: #fff;
  border-radius: var(--r-2);
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-3);
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  animation: toast-in 260ms var(--ease-out);
  max-width: 90vw;
}
.toast[data-state="success"] {
  background: #136a3a;
}
.toast[data-state="error"] {
  background: var(--red-600);
}
.toast--out { animation: toast-out 220ms var(--ease-out) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ============ ACCOUNT-PAGE NAV STATE NEEDS (reuse the homepage nav) ============ */

/* When using the homepage nav on inner pages, force solid state because there's
   no full-bleed dark hero behind it. */
.has-solid-nav .nav { background: rgba(255,255,255,0.92); color: var(--ink-900); border-bottom-color: var(--line); box-shadow: var(--shadow-nav); height: var(--nav-h-compact); backdrop-filter: saturate(180%) blur(12px); }
.has-solid-nav .nav .nav__brand img { filter: none; }
