/* akash-world -- plain CSS, no build step, no framework.
   docs/architecture.md: "Jinja2, plain CSS, vanilla JS. No SPA, no build step." */

:root {
  /* Same palette as the landing page's --landing-* tokens (kept as a
     separate set there since that page is a fully self-contained layout) --
     one design system across the whole site. */
  --color-bg: #f1f1ea;
  --color-surface: #ffffff;
  --color-border: #e2e2d8;
  --color-text: #14170f;
  --color-text-muted: #6b6f63;
  --color-accent: #dcf24e;
  --color-link: #2f5d34;
  --color-success: #2f6b3a;
  --color-danger: #b3392f;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 2rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}

.site-header .brand:hover {
  text-decoration: none;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: var(--color-text);
  color: var(--color-accent);
  flex-shrink: 0;
}

.site-logo svg {
  width: 1.15rem;
  height: 1.15rem;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--color-text-muted);
}

.site-nav a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.site-nav .nav-credits {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.site-nav .nav-credits:hover {
  border-color: var(--color-link);
  text-decoration: none;
}

.site-nav .nav-user {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding-left: 0.3rem;
  border-left: 1px solid var(--color-border);
}

.nav-logout-form {
  display: inline-flex;
  margin: 0;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.link-button:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* --- Error pages --- */

.error-page {
  text-align: center;
  padding: 3rem 1rem;
}

.error-page .error-code {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
  margin: 0 0 0.5rem;
}

.error-page h1 {
  margin: 0 0 1rem;
  font-size: 1.75rem;
}

.error-page p {
  color: var(--color-text-muted);
}

.error-page .request-id {
  margin-top: 2rem;
  font-size: 0.85rem;
}

.error-page .request-id code {
  font-family: var(--font-mono);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  padding: 0.15rem 0.4rem;
  color: var(--color-text);
}

/* --- Forms (used from Phase 3 onward) --- */

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

.form-field label.radio-option {
  display: block;
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 400;
  margin-bottom: 0.4rem;
}

.radio-option input[type="radio"] {
  width: auto;
  margin-right: 0.4rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  color: var(--color-text);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  background: var(--color-text);
  color: var(--color-bg);
  border: none;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

button:hover,
.button:hover {
  filter: brightness(1.3);
}

.button-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  margin-left: 0.5rem;
}

.button-secondary:hover {
  border-color: var(--color-text);
  filter: none;
}

.flash-messages {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.flash-messages li {
  padding: 0.75rem 1rem;
  border-radius: 0.6rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.flash-error {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.flash-success {
  border-color: var(--color-success);
  color: var(--color-success);
}

/* --- Badges (used from Phase 4 onward: product access, run status) --- */

.badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  background: var(--color-surface);
}

.badge-access {
  border-color: var(--color-success);
  color: var(--color-success);
}

.badge-no-access {
  color: var(--color-text-muted);
}

/* --- Dashboard, usage and admin tables (Phase 8) --- */

.dashboard section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.dashboard section h2 {
  margin-top: 0;
}

.dashboard-products ul,
.dashboard-runs ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-products li,
.dashboard-runs li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
}

.dashboard-products li:last-child,
.dashboard-runs li:last-child {
  border-bottom: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--color-border);
}

th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

dl {
  margin: 0;
}

dt {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

dd {
  margin: 0;
}

.run-state {
  color: var(--color-text-muted);
}

.run-result {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.run-result-field {
  border: 1px solid var(--color-border);
  border-radius: 0.6rem;
  background: var(--color-surface);
  padding: 1rem 1.25rem;
}

.run-result-question {
  margin-bottom: 1.5rem;
}

.run-result-key {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.run-result-value {
  white-space: pre-wrap;
  word-break: break-word;
}

.run-result-code {
  margin: 0;
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.error {
  color: var(--color-danger);
}

/* --- Storage usage bar ---
   A native <progress> element, not a div with an inline `width: X%` --
   the production CSP (infra/Caddyfile) is style-src 'self' with no
   unsafe-inline, which would silently drop a per-user, genuinely dynamic
   inline style. <progress> needs no inline style at all; its fill is
   drawn by the browser from value/max, and only the pseudo-elements
   below need real stylesheet rules. */

.storage-usage {
  margin-bottom: 1.5rem;
}

.storage-usage-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

.storage-usage-bar {
  width: 100%;
  height: 0.6rem;
  border: none;
  border-radius: 999px;
  overflow: hidden;
}

.storage-usage-bar::-webkit-progress-bar {
  background: var(--color-border);
  border-radius: 999px;
}

.storage-usage-bar::-webkit-progress-value {
  background: var(--color-text);
  border-radius: 999px;
}

.storage-usage-bar::-moz-progress-bar {
  background: var(--color-text);
  border-radius: 999px;
}

.storage-usage-bar-full::-webkit-progress-value {
  background: var(--color-danger);
}

.storage-usage-bar-full::-moz-progress-bar {
  background: var(--color-danger);
}

/* --- Auth pages (login/register/verify/forgot/reset) --- */

.auth-page {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 2rem;
}

.auth-card h1 {
  margin-top: 0;
}

.auth-card .form-field {
  margin-bottom: 1.1rem;
}

.auth-card button[type="submit"] {
  width: 100%;
  justify-content: center;
}

.auth-links {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
}

.auth-hint {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: -0.5rem 0 1.25rem;
}

.password-field {
  position: relative;
}

.password-field input[type="password"],
.password-field input[type="text"] {
  padding-right: 3.25rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 0.25rem;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--color-text);
}

.password-strength {
  list-style: none;
  margin: -0.4rem 0 1.1rem;
  padding: 0;
  font-size: 0.82rem;
}

.password-strength li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-text-muted);
  padding: 0.1rem 0;
}

.password-strength li::before {
  content: "\2717";
  color: var(--color-danger);
  font-weight: 700;
  width: 1em;
}

.password-strength li.met {
  color: var(--color-text);
}

.password-strength li.met::before {
  content: "\2713";
  color: var(--color-success);
}

/* --- Landing page (marketing) ---
   Deliberately its own light theme, scoped under body.landing-page --
   the rest of the app shares one design system via the :root tokens
   above, but this page's layout (hero, chart mockup) is unique to it.
   base.html exposes {% block header/footer %} so this page can replace
   the chrome entirely instead of fighting the shared defaults. */

body.landing-page {
  --landing-bg: #f1f1ea;
  --landing-surface: #ffffff;
  --landing-ink: #14170f;
  --landing-muted: #6b6f63;
  --landing-border: #e2e2d8;
  --landing-accent: #dcf24e;
  background: var(--landing-bg);
  color: var(--landing-ink);
}

body.landing-page .site-main {
  max-width: none;
  padding: 0;
  margin: 0;
}

.landing-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 3rem;
  border-bottom: 1px solid var(--landing-border);
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--landing-ink);
  font-weight: 700;
  font-size: 1.05rem;
}

.landing-brand:hover {
  text-decoration: none;
}

.landing-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: var(--landing-ink);
  color: var(--landing-accent);
}

.landing-logo svg {
  width: 1.15rem;
  height: 1.15rem;
}

.landing-nav {
  display: flex;
  gap: 2rem;
  justify-self: center;
}

.landing-nav a {
  color: var(--landing-muted);
  font-size: 0.95rem;
}

.landing-nav a:hover {
  color: var(--landing-ink);
  text-decoration: none;
}

.landing-header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.landing-login,
.landing-register {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

.landing-login {
  border: 1px solid var(--landing-ink);
  background: var(--landing-surface);
  color: var(--landing-ink);
}

.landing-login:hover {
  text-decoration: none;
  background: var(--landing-ink);
  color: var(--landing-surface);
}

.landing-register {
  border: 1px solid transparent;
  color: var(--landing-muted);
}

.landing-register:hover {
  text-decoration: none;
  color: var(--landing-ink);
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  padding: 4.5rem 3rem;
  max-width: 90rem;
  margin: 0 auto;
}

.landing-badge {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--landing-border);
  background: var(--landing-surface);
  color: var(--landing-ink);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.landing-hero-copy h1 {
  font-size: clamp(2.25rem, 4.5vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  font-weight: 800;
}

.landing-lede {
  color: var(--landing-muted);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 34rem;
  margin: 0 0 2rem;
}

.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}

.landing-btn:hover {
  text-decoration: none;
}

.landing-btn-primary {
  background: var(--landing-ink);
  color: var(--landing-bg);
}

.landing-btn-primary:hover {
  filter: brightness(1.2);
}

.landing-btn-outline {
  background: var(--landing-surface);
  color: var(--landing-ink);
  border: 1px solid var(--landing-border);
}

.landing-btn-outline:hover {
  border-color: var(--landing-ink);
}

.landing-checklist {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0;
  margin: 0;
  color: var(--landing-muted);
  font-size: 0.9rem;
}

.landing-checklist li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.landing-check {
  color: #4c8a3f;
  font-weight: 700;
}

.landing-hero-visual {
  position: relative;
  min-height: 26rem;
}

.landing-visual-backdrop {
  position: absolute;
  inset: 1rem -1rem 1.5rem 2rem;
  background: var(--landing-accent);
  border-radius: 1.75rem;
  transform: rotate(4deg);
}

.landing-visual-card {
  position: relative;
  background: var(--landing-ink);
  border-radius: 1.5rem;
  padding: 1.5rem;
  transform: rotate(-1.5deg);
  box-shadow: 0 1.5rem 3rem rgba(20, 23, 15, 0.25);
  color: var(--landing-bg);
}

.landing-visual-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(241, 241, 234, 0.15);
}

.landing-visual-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.6rem;
  background: var(--landing-accent);
  color: var(--landing-ink);
  flex-shrink: 0;
}

.landing-visual-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.landing-visual-title {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.landing-visual-title small {
  color: rgba(241, 241, 234, 0.6);
  font-size: 0.8rem;
}

.landing-visual-tag {
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  background: rgba(241, 241, 234, 0.12);
  font-size: 0.75rem;
  color: rgba(241, 241, 234, 0.75);
}

.landing-visual-question {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  background: rgba(241, 241, 234, 0.08);
  color: rgba(241, 241, 234, 0.85);
  font-size: 0.9rem;
}

.landing-visual-chart {
  background: var(--landing-surface);
  color: var(--landing-ink);
  border-radius: 1rem;
  padding: 1.25rem;
}

.landing-visual-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.landing-visual-chart-header small {
  color: var(--landing-muted);
}

.landing-visual-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  height: 7rem;
  margin-bottom: 1rem;
}

.landing-visual-bars span {
  flex: 1;
  background: var(--landing-accent);
  border-radius: 0.35rem 0.35rem 0 0;
}

/* Fixed decorative heights as static classes rather than inline `style`
   attributes -- the production Caddyfile's CSP is `style-src 'self'` with
   no `unsafe-inline`, which would silently zero out any inline style. */
.landing-visual-bar-1 {
  height: 45%;
}
.landing-visual-bar-2 {
  height: 62%;
}
.landing-visual-bar-3 {
  height: 52%;
}
.landing-visual-bar-4 {
  height: 88%;
}
.landing-visual-bar-5 {
  height: 70%;
}

.landing-visual-insight {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--landing-bg);
  border-radius: 0.6rem;
  font-size: 0.85rem;
  color: var(--landing-muted);
}

.landing-visual-insight strong {
  color: var(--landing-ink);
}

.landing-how {
  max-width: 90rem;
  margin: 0 auto;
  padding: 3rem 3rem 5rem;
  border-top: 1px solid var(--landing-border);
}

.landing-how h2 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.landing-how-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 2rem;
}

.landing-how-step {
  display: inline-block;
  color: var(--landing-muted);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.landing-how-steps h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.landing-how-steps p {
  margin: 0;
  color: var(--landing-muted);
  font-size: 0.9rem;
}

.landing-footer {
  max-width: 90rem;
  margin: 0 auto;
  padding: 1.5rem 3rem 2.5rem;
  color: var(--landing-muted);
  font-size: 0.85rem;
}

@media (max-width: 60rem) {
  .landing-hero {
    grid-template-columns: 1fr;
    padding: 2.5rem 1.5rem;
  }

  .landing-header {
    grid-template-columns: 1fr auto;
    padding: 1rem 1.5rem;
  }

  .landing-nav {
    display: none;
  }

  .landing-hero-visual {
    min-height: 22rem;
  }

  .landing-how {
    padding: 2.5rem 1.5rem 3.5rem;
  }
}
