/* marketing_app shell — ported from the Bzz desktop dashboard
   (apps/bzz/desktop/dashboard/style.css). Color tokens (dark/light/bzz)
   now come from the vendored tokens.css (canonical: shared-ui/tokens.css),
   loaded before this file — see index.html. This file only ADDS the
   app-shell layout vars and the few extra color tokens tokens.css doesn't
   define for dark/light, plus the --green/--orange/--red aliases this
   app's markup already uses. Never redeclare a name tokens.css already
   sets (--bg, --primary, --success, --warning, --danger, etc.) — that's
   exactly the drift shared-ui/tokens.css exists to prevent. */

:root {
  --page-max-width: 1200px;
  /* App-shell sizing — JS overrides at runtime via document.documentElement */
  --topbar-h: 90px;
  --footer-h: 32px;
  --text-faint: #4e5967;
  --text-ghost: #3d4652;
  --on-accent:  #1a1200;
  --green:      var(--success);
  --green-bg:   var(--success-bg);
  --orange:     var(--warning);
  --orange-bg:  var(--warning-bg);
  --red:        var(--danger);
  --red-bg:     var(--danger-bg);
}
html.light {
  --text-faint: #a89f91;
  --text-ghost: #b7c0cc;
  --on-accent:  #1a1200;
  --focus-ring: rgba(168, 128, 21, 0.24);
  --green:      var(--success);
  --green-bg:   var(--success-bg);
  --orange:     var(--warning);
  --orange-bg:  var(--warning-bg);
  --red:        var(--danger);
  --red-bg:     var(--danger-bg);
}
html.bzz {
  --green:      var(--success);
  --green-bg:   var(--success-bg);
  --orange:     var(--warning);
  --orange-bg:  var(--warning-bg);
  --red:        var(--danger);
  --red-bg:     var(--danger-bg);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ── Top bar (fixed to viewport top) ── */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
}
header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 20;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.brand-link { display: flex; align-items: center; text-decoration: none; }
.brand-icon { width: 44px; height: 44px; }
.brand-word { color: var(--text-head); font-size: 18px; font-weight: 600; line-height: 1.15; }
.brand-sub { color: var(--accent); font-size: 12px; font-weight: 600; margin-top: 1px; }
.session-info { font-size: 12px; color: var(--text-dim); }
.header-right { display: flex; align-items: center; gap: 12px; }

.status-badge {
  font-size: 13px;
  padding: 3px 11px;
  border-radius: 12px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid currentColor;
  transition: background 0.3s, color 0.3s;
  min-width: 100px;
  text-align: center;
  box-sizing: border-box;
}
.status-badge.error { background: var(--red-bg); color: var(--red); }

/* ── Version chip (bottom-right, always visible) — /version badge ── */
.version-chip-wrap { position: relative; margin-left: auto; }
.version-chip {
  font: inherit;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 8px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-faint);
  border: 1px solid var(--border);
  cursor: pointer;
}
.version-chip:hover, .version-chip[aria-expanded="true"] {
  color: var(--text-dim);
  border-color: var(--text-faint);
}
.version-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  padding: 12px;
  z-index: 200;
}
.version-popover.open { display: block; }
.version-popover-build {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.version-popover-changes { display: flex; flex-direction: column; gap: 6px; }
.version-popover-change { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.version-popover-change .req-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--text-faint);
  margin-right: 4px;
}
.version-popover-empty { font-size: 12px; color: var(--text-faint); font-style: italic; }

.tenant-setup-step { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.tenant-setup-step h3 { color: var(--text-head); font-size: 15px; margin-bottom: 6px; }
.tenant-setup-step p { color: var(--text-muted); line-height: 1.45; margin-bottom: 10px; }
.setup-state { color: var(--warning); font-size: 12px; font-weight: 500; }
.setup-state.complete { color: var(--success); }
.setup-validation { color: var(--warning); }
.tenant-setup-form { display: grid; gap: 8px; margin: 10px 0; max-width: 520px; }
.tenant-setup-form label { color: var(--text-muted); display: grid; gap: 4px; font-size: 12px; }
.tenant-setup-form input, .tenant-setup-form select { background: var(--bg-input); border: 1px solid var(--border); border-radius: 5px; color: var(--text); padding: 8px; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { color: var(--text-head); border-color: var(--text-muted); }
.width-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
  white-space: nowrap;
}
.width-toggle:hover { color: var(--text-head); border-color: var(--text-muted); }

/* Account chip + dropdown — the header name is the menu trigger. */
#account-area { display: flex; align-items: center; gap: 6px; }
.account-chip {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-head);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.15s;
}
.account-chip:hover { color: var(--text-head); border-color: var(--border); background: var(--bg-hover); }
.account-menu {
  display: none;  /* app.js shows it via element.style.display */
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  padding: 6px;
  z-index: 1000;
}
.account-menu-email {
  font-size: 11px;
  color: var(--text-faint);
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border-dim);
  margin-bottom: 4px;
  word-break: break-all;
}
.account-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  font-family: inherit;
}
.account-menu-item:hover { background: var(--bg-hover); color: var(--text-head); }
.account-menu-signout { color: var(--red); }
.account-menu-signout:hover { background: var(--red-bg); color: var(--red); }

/* ── Nav ───────────────────────────────────────── */
nav {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 19;
}
.nav-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.nav-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-breadcrumb a:hover { color: var(--accent); }
.nav-breadcrumb .bc-sep { color: var(--text-faint); font-size: 11px; }
.nav-breadcrumb .bc-current {
  color: var(--text-head);
  font-weight: 600;
}
.nav-tabs {
  display: flex;
}
.nav-tabs a {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
/* Icons ride currentColor, so they pick up the per-theme accent on .active
   and the hover color for free in dark, light, and bzz modes. */
.nav-tabs a .nav-ico { width: 15px; height: 15px; flex-shrink: 0; }
.nav-tabs a:hover { color: var(--text); }
.nav-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-tabs a.cog-btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 12px; }
.nav-tabs a.cog-btn svg { display: block; transition: transform 0.3s ease; }
.nav-tabs a.cog-btn:hover svg { transform: rotate(45deg); }

/* ── Main / tabs / footer ──────────────────────── */
main {
  position: fixed;
  top: var(--topbar-h);
  bottom: var(--footer-h);
  left: 0;
  right: 0;
  overflow-y: auto;
  padding: 24px;
}
.tab { display: none; max-width: var(--page-max-width); margin: 0 auto; }
.tab.active { display: block; }
html.width-standard-plus { --page-max-width: 1400px; }
html.width-wide { --page-max-width: 1600px; }
html.width-ultra { --page-max-width: 2000px; }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
}
.card h2 { margin: 0 0 8px; color: var(--text-head); font-size: 20px; }
.card p { color: var(--text-muted); line-height: 1.5; }

.copyright {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--footer-h);
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  color: var(--text-dim);
  font-size: 12px;
  z-index: 100;
}

/* ── Sign-in gate overlay — blocks the whole UI until the user
   authenticates. Ported verbatim from bzz (index.html inline styles). ── */
.signin-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  z-index: 10000; display: none; align-items: center; justify-content: center;
}
.signin-overlay.visible { display: flex; }
.signin-modal {
  position: relative;
  background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  width: 92%; max-width: 460px; padding: 32px 28px; text-align: center;
}
.signin-modal h2 { margin: 0 0 8px; font-size: 20px; text-align: center; }
.signin-modal p { margin: 0 0 22px; color: var(--text-dim); font-size: 14px; text-align: center; }
.signin-oauth { display: flex; flex-direction: column; gap: 10px; }
.signin-modal .btn-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; font-size: 15px;
  border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.signin-modal .btn-login:hover { border-color: var(--accent); }
.signin-divider {
  display: flex; align-items: center; gap: 12px; margin: 18px 0 14px;
  color: var(--text-dim); font-size: 12px;
}
.signin-divider::before, .signin-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.signin-form { display: flex; flex-direction: column; text-align: left; }
.signin-form label {
  font-size: 12px; color: var(--text-dim); margin: 10px 0 4px;
}
.signin-form input {
  padding: 11px 12px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.signin-form input:focus { outline: none; border-color: var(--accent); }
.signin-submit {
  margin-top: 16px; padding: 12px 16px; font-size: 15px; font-weight: 600;
  border: none; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
}
.signin-submit:hover { filter: brightness(1.08); }
.signin-submit:disabled { opacity: 0.6; cursor: default; }
.signin-links {
  display: flex; flex-direction: column; gap: 6px; margin-top: 16px;
  font-size: 12px; text-align: center;
}
.signin-links a { color: var(--text-dim); text-decoration: underline; }
.signin-links a:hover { color: var(--text); }
/* BZZ-SIGNIN-002: sign-in outcomes are alert-styled, not dim footnotes. */
.signin-status { margin-top: 14px; font-size: 14px; color: var(--text-dim); min-height: 18px; text-align: center; }
.signin-status.error, .signin-status.success {
  padding: 10px 12px; border-radius: 8px; font-weight: 600; text-align: left;
}
.signin-status.error {
  color: #e0654f; background: rgba(224, 101, 79, 0.12); border: 1px solid rgba(224, 101, 79, 0.45);
}
.signin-status.success {
  color: #3fae6a; background: rgba(63, 174, 106, 0.12); border: 1px solid rgba(63, 174, 106, 0.45);
}
.signin-pw-wrap { position: relative; }
.signin-pw-wrap input { width: 100%; padding-right: 40px; box-sizing: border-box; }
.acct-pw-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-dim);
  line-height: 0; padding: 4px;
}
.acct-pw-eye:hover { color: var(--text); }
.acct-pw-eye svg { width: 18px; height: 18px; fill: currentColor; }
.signin-theme-toggle {
  position: absolute; top: 12px; right: 12px;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-dim); cursor: pointer; padding: 6px 8px; line-height: 0;
  font-size: 15px;
}
.signin-theme-toggle:hover { color: var(--text); border-color: var(--accent); }
