/* DakLab investor portal, tuned to a restrained Vercel-like system. */
:root {
  --font-body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  --theme-primary: #0a72ef;
  --theme-primary-hover: #065fc6;
  --theme-primary-soft: #eef6ff;
  --theme-success: #10b981;
  --theme-success-soft: #d1fae5;
  --theme-warning-soft: #ffedd5;
  --theme-warning-ink: #c2410c;
  --theme-background: #ffffff;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --theme-text-primary: #171717;
  --theme-text-secondary: #3f3f46;
  --theme-text-muted: #71717a;
  --theme-ring: hsl(212deg 100% 48%);
  --shadow-border: 0 0 0 1px rgb(0 0 0 / 0.08);
  --shadow-card: 0 0 0 1px rgb(0 0 0 / 0.08), 0 2px 2px rgb(0 0 0 / 0.04),
    0 18px 34px rgb(0 0 0 / 0.03), 0 0 0 1px #fafafa inset;
  --shadow-subtle: 0 0 0 1px rgb(0 0 0 / 0.06);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-btn: 10px;
  --sidebar-width: 272px;
  --white: #ffffff;
  --success: #047857;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--theme-text-primary);
  background: var(--theme-background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html {
  color-scheme: light;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----- App shell: sidebar + main ----- */
.app-root {
  display: flex;
  min-height: 100vh;
}

.portal-locked .app-root {
  display: block;
}

.portal-locked .app-sidebar,
.portal-locked .main-header {
  display: none;
}

.portal-locked .app-main {
  min-height: 100vh;
  justify-content: center;
  background:
    radial-gradient(circle at 10% -20%, rgb(82 67 254 / 0.12), transparent 46%),
    radial-gradient(circle at 100% 0%, rgb(10 114 239 / 0.12), transparent 40%),
    var(--theme-background);
}

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  box-shadow: inset -1px 0 0 rgb(0 0 0 / 0.08);
  padding: 24px 12px 20px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
  padding-bottom: 22px;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.08);
}

.sidebar-logo-link {
  display: inline-flex;
  line-height: 0;
}

.sidebar-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
}

.sidebar-product {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--theme-text-muted);
}

.sidebar-heading {
  margin: 0 0 10px;
  padding: 0 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--theme-text-muted);
}

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

.nav-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px 10px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--theme-text-secondary);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.nav-item:hover {
  background: rgb(255 255 255 / 0.9);
  color: var(--theme-text-primary);
}

/* Active: soft blue field + bar on the inner edge of the sidebar (next to main) */
.nav-item.active {
  position: relative;
  background: var(--theme-primary-soft);
  color: var(--theme-primary);
  font-weight: 600;
  box-shadow: inset -2px 0 0 var(--theme-primary), var(--shadow-border);
}

.nav-icon {
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.85;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.sidebar-spacer {
  flex: 1;
  min-height: 16px;
}

.sidebar-footnote {
  margin: 0;
  padding: 12px 10px 0;
  font-size: 0.7rem;
  color: var(--theme-text-muted);
  line-height: 1.4;
}

.app-main {
  flex: 1;
  min-width: 0;
  background: var(--theme-background);
  display: flex;
  flex-direction: column;
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(20px, 4vw, 36px) 22px;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.08);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--theme-text-primary);
  text-wrap: balance;
}

.main-subtitle {
  margin: 6px 0 0;
  font-size: 0.9375rem;
  color: var(--theme-text-muted);
  max-width: 52ch;
}

.btn-outline {
  appearance: none;
  margin-top: 2px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--theme-text-secondary);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-border);
  cursor: pointer;
  transition: box-shadow 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.btn-outline:hover {
  background: #fafafa;
}

.btn-outline:focus-visible {
  outline: none;
  box-shadow: var(--shadow-border), 0 0 0 3px hsl(212deg 100% 48% / 0.2);
}

/* ----- Login ----- */
.login-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 48px) clamp(20px, 4vw, 36px) 48px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.login-card-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--theme-text-primary);
}

.login-card-lead {
  margin: 8px 0 20px;
  font-size: 0.9375rem;
  color: var(--theme-text-muted);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--theme-text-secondary);
}

#loginForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-field,
#loginForm input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-border);
  transition: box-shadow 0.12s ease, background-color 0.12s ease;
}

.search-field:focus-visible,
#loginForm input:focus-visible {
  outline: none;
  box-shadow: var(--shadow-border), 0 0 0 3px hsl(212deg 100% 48% / 0.2);
}

.btn-primary {
  appearance: none;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--white);
  background: var(--theme-primary);
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
  position: relative;
}

.btn-primary:hover {
  background: var(--theme-primary-hover);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px hsl(212deg 100% 48% / 0.24);
}

.btn-primary.is-loading {
  pointer-events: none;
  opacity: 0.92;
}

.btn-primary.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 999px;
  border: 2px solid rgb(255 255 255 / 0.45);
  border-top-color: #ffffff;
  animation: spin 0.65s linear infinite;
}

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

.form-message {
  min-height: 20px;
  margin: 0;
  font-size: 0.8125rem;
  color: #b91c1c;
}

.questionnaire-form .form-message {
  margin-top: 2px;
}

/* ----- Library ----- */
.library-panel {
  flex: 1;
  padding: 22px clamp(20px, 4vw, 36px) 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ElevenLabs Convai: float above the app; DakLab-tinted orb is set in JS on the custom element. */
#daklab-elevenlabs,
elevenlabs-convai.daklab-convai {
  --elevenlabs-convai-widget-width: min(100vw, 400px);
}

#daklab-elevenlabs {
  position: fixed;
  z-index: 10000;
  right: 20px;
  bottom: 20px;
}

.library-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.start-here-card {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.start-here-card h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.start-here-card p {
  margin: 10px 0 0;
  color: var(--theme-text-secondary);
  font-size: 0.9375rem;
}

.start-here-links {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.start-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  box-shadow: var(--shadow-border);
  color: var(--theme-text-primary);
  text-decoration: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  background: #fff;
}

.start-link:hover {
  background: #fafafa;
}

.start-link:focus-visible {
  outline: none;
  box-shadow: var(--shadow-border), 0 0 0 3px hsl(212deg 100% 48% / 0.2);
}

.start-here-note {
  margin-top: 14px;
}

.search-field {
  max-width: 380px;
  background: var(--surface);
}

.document-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
  align-items: center;
}

.home-hero-copy {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: clamp(18px, 2vw, 26px);
}

.home-hero-copy h2 {
  margin: 4px 0 0;
  font-size: clamp(1.25rem, 1.4vw, 1.55rem);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.home-hero-lead {
  margin: 10px 0 0;
  color: var(--theme-text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 56ch;
}

.home-primary-links {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-hero-note {
  margin: 14px 0 0;
  font-size: 0.875rem;
  color: var(--theme-text-secondary);
}

.home-external-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid hsl(220deg 14% 90%);
}

.home-webapp-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.home-webapp-link:hover {
  background: #1d1d1d;
}

.home-webapp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #fff;
  color: #111;
}

.home-store-badges {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.store-badge {
  display: block;
  height: auto;
}

.store-badge-apple {
  width: 145px;
}

.store-badge-google {
  width: 188px;
}

.home-hero-art {
  display: flex;
  justify-content: flex-end;
}

.home-hero-phone {
  width: min(100%, 260px);
  height: auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 20px 24px rgb(15 23 42 / 0.22));
  transform: rotate(-5deg);
}

.doc-section-title {
  margin: 0 0 12px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--theme-text-primary);
}

.doc-table {
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.08);
  transition: background-color 0.1s ease;
}

.doc-row:hover {
  background: #fcfcfd;
}

.doc-row:last-child {
  box-shadow: none;
}

.doc-cell-main {
  min-width: 0;
}

.doc-name {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--theme-text-primary);
}

.doc-desc {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--theme-text-muted);
  line-height: 1.45;
}

.doc-cell-action {
  justify-self: end;
}

.btn-row {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: box-shadow 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.btn-row-primary {
  color: var(--white);
  background: var(--theme-primary);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

.btn-row-primary:hover {
  background: var(--theme-primary-hover);
}

.btn-row-muted {
  color: var(--theme-text-muted);
  background: #f4f4f5;
  cursor: not-allowed;
}

.msg-eyebrow {
  margin: 0 0 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--theme-text-muted);
}

.message-card {
  padding: 28px;
  text-align: center;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.message-card h3 {
  margin: 8px 0 6px;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
}

.message-card p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--theme-text-muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  background: rgb(23 23 23 / 0.4);
  padding: clamp(16px, 4vw, 36px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

.modal-card {
  width: min(880px, 100%);
  margin: 24px 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 22px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.modal-close {
  margin-top: 0;
}

.questionnaire-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.questionnaire-form input[type="text"],
.questionnaire-form input[type="date"],
.questionnaire-form textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-border);
}

.questionnaire-form textarea {
  resize: vertical;
}

.questionnaire-form input:focus-visible,
.questionnaire-form textarea:focus-visible {
  outline: none;
  box-shadow: var(--shadow-border), 0 0 0 3px hsl(212deg 100% 48% / 0.2);
}

.q-set {
  margin: 0;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-border);
  display: grid;
  gap: 8px;
}

.q-set legend {
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0 4px;
  color: var(--theme-text-secondary);
}

.q-set label {
  font-size: 0.875rem;
  color: var(--theme-text-secondary);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .app-root {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-right: none;
    box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.08);
  }

  .sidebar-brand {
    flex-direction: row;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    gap: 12px;
    flex: 1;
    min-width: 0;
  }

  .sidebar-heading {
    width: 100%;
    padding: 8px 10px 0;
    margin-bottom: 0;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    flex-shrink: 0;
    white-space: nowrap;
    max-width: 240px;
  }

  .nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-spacer,
  .sidebar-footnote {
    display: none;
  }

  .doc-row {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: flex-start;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .home-hero-art {
    justify-content: center;
  }

  .home-hero-phone {
    width: min(72vw, 240px);
    transform: rotate(-4deg);
  }

  .home-store-badges {
    gap: 8px;
  }

  .store-badge-apple {
    width: 132px;
  }

  .store-badge-google {
    width: 174px;
  }

  .doc-cell-action {
    justify-self: stretch;
  }

  .btn-row {
    width: 100%;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .modal-card {
    margin: 10px 0;
    padding: 16px;
  }
}
