/* ==========================================================================
   App layer — forms, auth pages, dashboard, notifications.
   Builds on the design tokens and .btn/.wrap/.h1/.h2 rules already defined
   in homepage.css (--cream, --ink, --ochre, --data-green, --rule, --r-*).
   ========================================================================== */

.app-main {
  padding: 160px 0 96px;
  min-height: 70vh;
}

.app-shell {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.auth-shell {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 24px;
}

.panel {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--paper-shadow);
  padding: 40px;
}

@media (max-width: 640px) {
  .panel { padding: 28px 20px; }
  .app-main { padding: 128px 0 64px; }
}

.panel-header { margin-bottom: 28px; }
.panel-header .h2 { font-size: clamp(26px, 4vw, 34px); margin-bottom: 8px; }
.panel-header p { color: var(--ink-ghost); margin: 0; }

/* ---- Forms ---- */
.form-grid { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: flex; flex-direction: column; gap: 8px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 560px) { .form-row.two-col { grid-template-columns: 1fr; } }

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}
label .optional { color: var(--ink-ghost); font-weight: 400; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
textarea,
select {
  width: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
textarea { resize: vertical; min-height: 120px; font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--ink-ghost); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ochre);
  background: #fff;
}
input[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: #B3453A;
  background: #FBF1EF;
}

.password-field { position: relative; }
.password-field input { padding-right: 46px; }
.password-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  padding: 8px; cursor: pointer;
  color: var(--ink-ghost);
  font-size: 12px; font-weight: 600;
}
.password-toggle:hover { color: var(--ink); }

.field-hint { font-size: 12.5px; color: var(--ink-ghost); }
.field-error {
  font-size: 12.5px;
  color: #B3453A;
  font-weight: 600;
  min-height: 1em;
  display: none;
}
.field-error.is-visible { display: block; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-2);
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 2px;
  accent-color: var(--ochre-deep);
  flex-shrink: 0;
}
.checkbox-row a { color: var(--ochre-deep); font-weight: 600; text-decoration: underline; }

.form-actions { margin-top: 4px; }
button.btn { width: 100%; justify-content: center; }
button.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.btn-spinner {
  display: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(20,17,12,.25);
  border-top-color: var(--ink);
  animation: app-spin 0.7s linear infinite;
}
button.is-loading .btn-spinner { display: inline-block; }
button.is-loading .btn-label { opacity: 0.7; }
@keyframes app-spin { to { transform: rotate(360deg); } }

.auth-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--ink-ghost);
}
.auth-switch a { color: var(--ochre-deep); font-weight: 700; }

.auth-links-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  margin-top: -6px;
}
.auth-links-row a { color: var(--ink-ghost); font-weight: 500; }
.auth-links-row a:hover { color: var(--ink); }

/* ---- Notifications (toast + inline banners) ---- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.notice-success { background: #E8F1EC; color: var(--data-green); border: 1px solid rgba(42,93,79,.25); }
.notice-error   { background: #FBF1EF; color: #8C342A; border: 1px solid rgba(179,69,58,.25); }
.notice-info    { background: var(--cream-2); color: var(--ink-2); border: 1px solid var(--rule); }
.notice[hidden] { display: none; }

#toastStack {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  background: var(--ink);
  color: var(--cream);
  padding: 14px 18px;
  border-radius: var(--r-sm);
  font-size: 14px;
  box-shadow: 0 12px 30px -10px rgba(20,17,12,.4);
  animation: app-toast-in 0.2s ease-out;
}
.toast.toast-error { background: #8C342A; }
.toast.toast-success { background: var(--data-green); }
@keyframes app-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-ghost);
}
.empty-state .eyebrow { display: block; margin-bottom: 8px; }

/* ---- Dashboard ---- */
.acct-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 36px;
}
.acct-header .eyebrow { margin-bottom: 8px; display: block; }
.acct-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 900px) { .acct-grid { grid-template-columns: 1fr; } }

.acct-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 28px;
}
.acct-card.span-2 { grid-column: span 2; }
@media (max-width: 900px) { .acct-card.span-2 { grid-column: span 1; } }

.acct-card h3 { margin: 0 0 18px; }
.acct-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
}
.acct-stat-row:last-child { border-bottom: none; }
.acct-stat-row .label { color: var(--ink-ghost); }
.acct-stat-row .value { font-weight: 600; color: var(--ink); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-verified { background: #E8F1EC; color: var(--data-green); }
.badge-unverified { background: #FBF1EF; color: #8C342A; }

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.activity-item { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.activity-item .event { color: var(--ink); font-weight: 600; }
.activity-item .when { color: var(--ink-ghost); font-size: 12.5px; white-space: nowrap; }

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--rule) 25%, var(--cream-2) 50%, var(--rule) 75%);
  background-size: 200% 100%;
  animation: app-skeleton 1.4s ease infinite;
}
@keyframes app-skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- Nav auth slot (Login/Register <-> Dashboard/Logout) ---- */
[data-nav-auth-slot] { display: flex; align-items: center; gap: 12px; }
[data-nav-auth-slot-mobile] { display: flex; flex-direction: column; gap: 10px; }
[data-nav-auth-slot-mobile] .btn { justify-content: center; width: 100%; padding: 16px 24px; font-size: 16px; }

/* ---- Loading page guard (hides authed-only content until JS confirms) ---- */
[data-auth-guard] { display: none; }
[data-auth-guard].is-ready { display: block; }

/* ---- Honeypot (bots fill every visible field; humans never see this) --- */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}
