/* Sponsor dashboard — extends Oldwood home visual language */

:root {
  --dash-sidebar: 248px;
  --dash-top: 72px;
}

body.oldwood-dashboard {
  min-height: 100vh;
  background: var(--home-paper);
  color: var(--home-ink);
}

/* Auth gate splash (hidden once session ok) */
.dash-gate {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 40px 24px;
  background: var(--home-ink);
  color: var(--home-paper);
  text-align: center;
}

.dash-gate.is-visible {
  display: grid;
}

.dash-gate h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.dash-gate p {
  max-width: 42ch;
  margin: 0 auto 28px;
  opacity: 0.72;
}

.dash-gate .home-button {
  margin: 0 6px;
}

body.dash-gated .dash-app {
  display: none !important;
}

/* App chrome */
.dash-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--dash-sidebar) 1fr;
  grid-template-rows: var(--dash-top) 1fr;
}

.dash-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--dash-top);
  padding: 0 28px;
  background: var(--home-ink);
  color: var(--home-paper);
  border-bottom: 1px solid rgba(243, 240, 232, 0.12);
  z-index: 20;
}

.dash-header .home-wordmark {
  color: var(--home-paper);
}

.dash-header-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dash-header-meta .home-status-badge {
  color: var(--home-copper-soft);
}

.dash-user {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(243, 240, 232, 0.78);
}

.dash-signout {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(243, 240, 232, 0.28);
  background: transparent;
  color: var(--home-paper);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dash-signout:hover {
  background: rgba(243, 240, 232, 0.08);
}

/* Sidebar */
.dash-sidebar {
  grid-row: 2;
  padding: 28px 18px 32px;
  background: var(--home-white);
  border-right: 1px solid var(--home-border);
}

.dash-sidebar-label {
  margin: 0 12px 14px;
  color: var(--home-mist);
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--home-ink-2);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease;
}

.dash-nav-btn span.index {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--home-copper);
  opacity: 0.85;
}

.dash-nav-btn:hover {
  background: rgba(16, 37, 28, 0.04);
}

.dash-nav-btn.is-active {
  background: rgba(211, 154, 94, 0.12);
  border-color: rgba(211, 154, 94, 0.35);
  color: var(--home-ink);
}

.dash-sidebar-note {
  margin: 28px 12px 0;
  padding-top: 18px;
  border-top: 1px solid var(--home-border);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--home-mist);
}

/* Main */
.dash-main {
  grid-row: 2;
  padding: 32px 36px 64px;
  overflow-x: hidden;
}

.dash-panel {
  display: none;
  animation: dashIn 280ms ease;
}

.dash-panel.is-active {
  display: block;
}

@keyframes dashIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.dash-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
}

.dash-panel-head h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  max-width: 22ch;
}

.dash-panel-head .deck {
  margin: 10px 0 0;
  max-width: 54ch;
  color: rgba(16, 37, 28, 0.62);
  font-size: 0.95rem;
}

.dash-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Metric cards */
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 28px;
  background: var(--home-border);
  border: 1px solid var(--home-border);
}

.dash-metric {
  padding: 20px 18px;
  background: var(--home-white);
}

.dash-metric span {
  display: block;
  margin-bottom: 10px;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--home-mist);
}

.dash-metric strong {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.dash-metric small {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: rgba(16, 37, 28, 0.5);
}

/* Cards / grids */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 18px;
}

.dash-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.dash-card {
  padding: 22px 22px 24px;
  background: var(--home-white);
  border: 1px solid var(--home-border);
}

.dash-card h2,
.dash-card h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.dash-card p {
  margin: 0 0 12px;
  color: rgba(16, 37, 28, 0.72);
}

.dash-card ul {
  margin: 0;
  padding-left: 1.15rem;
  color: rgba(16, 37, 28, 0.78);
}

.dash-card li + li {
  margin-top: 6px;
}

.dash-card.ink {
  background: var(--home-ink-2);
  border-color: transparent;
  color: var(--home-paper);
}

.dash-card.ink p,
.dash-card.ink li {
  color: rgba(243, 240, 232, 0.78);
}

.dash-card.ink h2,
.dash-card.ink h3 {
  color: var(--home-white);
}

.dash-decision {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 3px solid var(--home-copper);
  background: rgba(211, 154, 94, 0.1);
  font-size: 0.9rem;
}

.dash-card.ink .dash-decision {
  background: rgba(211, 154, 94, 0.14);
  color: var(--home-paper);
}

/* Tables */
.dash-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--home-border);
  background: var(--home-white);
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-table th,
.dash-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--home-border);
  text-align: left;
  vertical-align: top;
}

.dash-table th {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--home-mist);
  background: rgba(16, 37, 28, 0.03);
}

.dash-table tr:last-child td {
  border-bottom: 0;
}

.dash-table .muted {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: rgba(16, 37, 28, 0.5);
}

/* Status pills */
.dash-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--home-border);
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--home-paper-2);
}

.dash-pill-observed { background: #e4efd8; border-color: rgba(100, 130, 70, 0.25); }
.dash-pill-estimated { background: #f5e6d0; border-color: rgba(180, 120, 50, 0.25); }
.dash-pill-pending,
.dash-pill-not_applicable { background: #eceae3; }
.dash-pill-verified { background: #d5e8c8; border-color: rgba(80, 120, 50, 0.3); }
.dash-pill-complete { background: #e4efd8; }
.dash-pill-in_progress { background: #f5e6d0; }
.dash-pill-upcoming { background: #eceae3; }

/* Progress bars */
.dash-bar {
  height: 6px;
  margin-top: 10px;
  background: rgba(16, 37, 28, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.dash-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--home-moss), var(--home-copper));
  border-radius: 99px;
}

/* Milestone list */
.dash-milestones {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-milestones li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--home-border);
  font-size: 0.88rem;
}

.dash-milestones li:last-child {
  border-bottom: 0;
}

.dash-milestones time {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  color: var(--home-mist);
}

/* Export centre */
.dash-export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.dash-export-card {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  padding: 24px;
  background: var(--home-white);
  border: 1px solid var(--home-border);
}

.dash-export-card .home-kicker {
  margin-bottom: 14px;
}

.dash-export-card h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.dash-export-card p {
  flex: 1;
  margin: 0 0 20px;
  color: rgba(16, 37, 28, 0.65);
  font-size: 0.9rem;
}

.dash-export-card .home-button {
  align-self: flex-start;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.dash-export-status {
  min-height: 1.2em;
  margin: 18px 0 0;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--home-mist);
}

.dash-talking {
  margin-top: 18px;
}

.dash-talking li {
  font-size: 0.86rem;
}

.dash-talking li.safe {
  color: #2b6044;
}

.dash-talking li.warn {
  color: #8a5a28;
}

/* Evidence records */
.dash-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-evidence-item {
  padding: 16px 18px;
  background: var(--home-white);
  border: 1px solid var(--home-border);
}

.dash-evidence-item header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.dash-evidence-item h3 {
  margin: 0;
  font-size: 1rem;
}

.dash-evidence-item p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(16, 37, 28, 0.68);
}

.dash-evidence-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 10px;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--home-mist);
}

/* Banner for demo / pre-land honesty */
.dash-honesty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 24px;
  padding: 12px 16px;
  border: 1px solid rgba(211, 154, 94, 0.35);
  background: rgba(211, 154, 94, 0.08);
  font-size: 0.8rem;
}

.dash-honesty strong {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a46737;
}

/* Loading */
.dash-loading {
  display: none;
  padding: 48px;
  text-align: center;
  color: var(--home-mist);
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-loading.is-visible {
  display: block;
}

/* Mobile */
@media (max-width: 1100px) {
  .dash-metrics { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-2,
  .dash-grid-3,
  .dash-export-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .dash-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .dash-sidebar {
    grid-row: 2;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--home-border);
  }

  .dash-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
  }

  .dash-nav-btn {
    flex: 0 0 auto;
    min-height: 40px;
    white-space: nowrap;
  }

  .dash-sidebar-label,
  .dash-sidebar-note {
    display: none;
  }

  .dash-main {
    grid-row: 3;
    padding: 24px 18px 48px;
  }

  .dash-header {
    padding: 0 16px;
    gap: 12px;
  }

  .dash-user {
    display: none;
  }
}

/* Sponsor login (signup.html) — same visual language as the dashboard gate */
body.oldwood-login {
  min-height: 100vh;
  background: var(--home-ink);
  color: var(--home-paper);
}

body.oldwood-login .login-header {
  background: var(--home-ink);
  border-bottom-color: var(--home-border-light);
}

body.oldwood-login .home-header-inner {
  justify-content: space-between;
}

.login-main {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 120px 24px 64px;
}

.login-card {
  width: min(460px, 100%);
  padding: 36px 32px 28px;
  background: var(--home-paper);
  color: var(--home-ink);
  box-shadow: var(--home-shadow);
}

.login-card h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.login-lead {
  margin: 0 0 28px;
  opacity: 0.72;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 8px;
}

.login-field label {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--home-ink-2);
}

.login-field input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--home-border);
  background: var(--home-white);
  color: var(--home-ink);
  font: inherit;
  font-size: 0.95rem;
}

.login-field input:focus-visible {
  outline: 3px solid rgba(211, 154, 94, 0.7);
  outline-offset: 3px;
}

.login-submit,
.login-passkey {
  width: 100%;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.login-passkey {
  margin-top: 0;
  min-height: 46px;
}

.login-links {
  display: grid;
  gap: 8px;
  margin: 22px 0 0;
}

.login-links a {
  color: var(--home-ink-2);
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.login-dialog {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 37, 28, 0.46);
  backdrop-filter: blur(4px);
}

.login-dialog-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(420px, calc(100% - 40px));
  padding: 28px 24px 22px;
  transform: translate(-50%, -50%);
  background: var(--home-paper);
  color: var(--home-ink);
  box-shadow: var(--home-shadow);
}

.login-dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--home-ink);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.login-dialog-actions {
  display: none;
  gap: 10px;
  margin-top: 18px;
}

.login-dialog-actions.visible {
  display: flex;
  flex-wrap: wrap;
}

.login-dialog-actions button {
  display: none;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--home-border);
  background: var(--home-white);
  color: var(--home-ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.login-dialog-actions button.visible {
  display: inline-flex;
  align-items: center;
}

@media (max-width: 1120px) {
  body.oldwood-login .home-header-link {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  body.oldwood-login .home-header-actions {
    display: flex;
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: 28px 20px 22px;
  }

  body.oldwood-login .home-header-actions .home-button {
    display: none;
  }
}

@media print {
  .dash-sidebar,
  .dash-header,
  .dash-panel-actions,
  .dash-nav {
    display: none !important;
  }

  .dash-app {
    display: block;
  }

  .dash-main {
    padding: 0;
  }

  .dash-panel {
    display: block !important;
    break-inside: avoid;
    margin-bottom: 24px;
  }
}
