/* ============================================================
   BennieTools — visual identity (v2)
   Palette: royal purple + gold (sampled from the logo)
   Display: Montserrat (echoes the wordmark) · Body: system sans
   Signature: the hexagon — stage markers and ambient brand shapes
   ============================================================ */

:root {
  --ink:        #221A30;
  --brand:      #4A2484;
  --brand-deep: #341A60;
  --brand-soft: #ECE6F6;
  --gold:       #D89A0E;
  --gold-deep:  #9C6F0C;
  --gold-soft:  #FBF0D4;
  --canvas:     #F4F2F8;
  --surface:    #ffffff;
  --muted:      #6B6478;
  --line:       #E5E1EE;
  --line-soft:  #EFECF6;
  --danger:     #B23A46;
  --ring:       rgba(74, 36, 132, 0.40);

  --font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --hex: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(34, 26, 48, 0.05), 0 8px 24px rgba(34, 26, 48, 0.07);
  --shadow-hover: 0 2px 4px rgba(34, 26, 48, 0.06), 0 14px 34px rgba(52, 26, 96, 0.14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; }
.brand-logo { display: block; width: 34px; height: 34px; }
.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--brand);
  font-size: 1.22rem;
}

.topnav { display: flex; align-items: center; gap: clamp(0.5rem, 2vw, 1.25rem); flex-wrap: wrap; }
.navlink {
  text-decoration: none; color: var(--muted); font-size: 0.92rem; font-weight: 600;
  padding: 0.3rem 0.1rem; border-bottom: 2px solid transparent;
}
.navlink:hover { color: var(--ink); border-bottom-color: var(--gold); }
.navlink-strong { color: var(--brand); }
.navuser {
  font-size: 0.9rem; color: var(--ink); font-weight: 700;
  padding-left: clamp(0.25rem, 2vw, 0.75rem); border-left: 1px solid var(--line);
}

/* ---------- Layout ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) clamp(1rem, 4vw, 2.5rem) 4rem; }
.page-head { margin-bottom: 2rem; }
.eyebrow {
  font-family: var(--font-display);
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-deep); font-weight: 700; margin: 0 0 0.55rem;
}
.page-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.12; letter-spacing: -0.02em;
  margin: 0; color: var(--ink);
}
.page-sub { color: var(--muted); margin: 0.55rem 0 0; font-size: 1.02rem; }

/* ---------- Lifecycle spine + hexagon markers (signature) ---------- */
.lifecycle { display: flex; flex-direction: column; gap: 0; }
.stage { display: grid; grid-template-columns: 56px 1fr; gap: clamp(1rem, 3vw, 2rem); padding-bottom: 2.4rem; }
.stage:last-child { padding-bottom: 0; }

.stage-marker { display: flex; flex-direction: column; align-items: center; }
.stage-num {
  position: relative; isolation: isolate;
  width: 54px; height: 60px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: #fff;
}
.stage-num::before { /* gold outer hexagon */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--gold); clip-path: var(--hex);
}
.stage-num::after {  /* purple inner hexagon */
  content: ""; position: absolute; inset: 3px; z-index: -1;
  background: var(--brand); clip-path: var(--hex);
}
.stage:not(:last-child) .stage-marker::after {
  content: ""; width: 2px; flex: 1 1 auto; margin: 0.55rem 0 -2.4rem;
  background: linear-gradient(var(--brand-soft), var(--line));
}

.stage-body { padding-top: 0.35rem; min-width: 0; }
.stage-eyebrow { font-family: var(--font-display); font-weight: 800; font-size: 1.18rem; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
.stage-blurb { color: var(--muted); margin: 0.2rem 0 1.1rem; font-size: 0.96rem; }
.stage-empty {
  position: relative; border: 1px dashed var(--brand-line, #D9CEEC); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; color: var(--muted); font-size: 0.94rem; background: rgba(255, 255, 255, 0.45);
}

/* ---------- Tool cards ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 0.9rem; }
.tool-card {
  display: flex; flex-direction: column; gap: 0.45rem; padding: 1.1rem 1.15rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--gold); }
.tool-card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.tool-name { font-family: var(--font-display); font-weight: 700; font-size: 1.0rem; color: var(--ink); }
.tool-desc { color: var(--muted); font-size: 0.9rem; line-height: 1.45; flex: 1; }
.tool-go { margin-top: 0.4rem; font-size: 0.86rem; font-weight: 700; color: var(--brand); }
.tool-card.is-soon .tool-go { color: var(--muted); }

.pill {
  font-family: var(--font-display);
  font-size: 0.62rem; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700;
  color: var(--gold-deep); background: var(--gold-soft);
  padding: 0.22rem 0.5rem; border-radius: 999px; white-space: nowrap;
}

/* ---------- Panels / tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 3vw, 1.6rem); box-shadow: var(--shadow); margin-bottom: 1.4rem; }
.panel-narrow { max-width: 460px; }
.panel-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin: 0 0 1rem; }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left; font-family: var(--font-display); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
  padding: 0 0.7rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 0.85rem 0.7rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.muted { color: var(--muted); }
.ta-right { text-align: right; }
.row-off { opacity: 0.55; }

.tag { font-family: var(--font-display); font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.1rem 0.4rem; border-radius: 5px; margin-left: 0.35rem; }
.tag-you { background: var(--brand-soft); color: var(--brand); }

.status { font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.status-on { color: var(--brand); }
.status-off { color: var(--muted); }
.status-lock { color: var(--danger); }
.status-pending { color: var(--gold-deep); }

.actions { display: flex; gap: 0.4rem; justify-content: flex-end; flex-wrap: wrap; }
.actions form { margin: 0; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form-row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 180px; }
.form-row .field-narrow { flex: 0 0 140px; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-size: 0.84rem; font-weight: 600; color: var(--ink); }
.field-hint { font-size: 0.78rem; color: var(--muted); }
.input {
  font-family: inherit; font-size: 0.98rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
select.input { appearance: none; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-display); font-size: 0.92rem; font-weight: 700; border-radius: var(--radius-sm);
  padding: 0.62rem 1.15rem; border: 1px solid transparent; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.82rem; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- Banners ---------- */
.banner { border-radius: var(--radius-sm); padding: 0.85rem 1rem; font-size: 0.94rem; margin-bottom: 1.2rem; border: 1px solid transparent; }
.banner-error { background: #fbe9eb; border-color: #f0c9cf; color: #7c2630; }
.banner-ok { background: var(--brand-soft); border-color: #d6c9ec; color: var(--brand-deep); }
.banner-key { background: var(--gold-soft); border-color: #f0d9a4; color: #6b4d0c; }
.banner-note { display: block; margin-top: 0.3rem; font-size: 0.82rem; color: #7a5a16; }
.key { background: #fff; border: 1px solid #e6c98a; padding: 0.12rem 0.45rem; border-radius: 6px; font-weight: 700; letter-spacing: 0.03em; }

/* ---------- Auth (login / setup) with ambient hexagons ---------- */
.auth-body {
  position: relative; overflow: hidden; min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1100px 520px at 50% -14%, var(--brand-soft), transparent 60%), var(--canvas);
}
.auth-body::before, .auth-body::after { content: ""; position: absolute; z-index: 0; clip-path: var(--hex); opacity: 0.07; }
.auth-body::before { width: 360px; height: 400px; background: var(--brand); top: -130px; left: -110px; }
.auth-body::after  { width: 320px; height: 356px; background: var(--gold);  bottom: -150px; right: -120px; }
.auth-shell { position: relative; z-index: 1; width: 100%; max-width: 400px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1.6rem, 5vw, 2.3rem); }
.auth-logo { display: block; width: 100%; max-width: 268px; height: auto; margin-bottom: 1.3rem; }
.auth-title { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; margin: 0 0 0.3rem; letter-spacing: -0.02em; color: var(--ink); }
.auth-sub { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.96rem; }
.auth-foot { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 1.25rem 0 0; }
.auth-alt { text-align: center; margin: 1rem 0 0; font-size: 0.9rem; }
.auth-alt a { color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.sitefoot { display: flex; align-items: center; justify-content: center; gap: 0.5rem; color: var(--muted); font-size: 0.84rem; padding: 2rem 1rem 2.5rem; }
.sitefoot::before { content: ""; width: 12px; height: 13px; background: var(--gold); clip-path: var(--hex); display: inline-block; }
.sitefoot-name { font-family: var(--font-display); font-weight: 700; color: var(--brand); }
.sitefoot-sep { opacity: 0.5; }

/* ---------- Tool stub page ---------- */
.tool-stub { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1.6rem, 5vw, 2.6rem); max-width: 640px; }
.tool-stub h1 { font-family: var(--font-display); font-weight: 800; margin: 0.4rem 0 0.5rem; font-size: 1.55rem; color: var(--ink); }
.tool-stub p { color: var(--muted); margin: 0 0 1.2rem; }
.backlink { color: var(--brand); font-weight: 700; text-decoration: none; font-size: 0.92rem; }
.backlink:hover { text-decoration: underline; }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 560px) {
  .stage { grid-template-columns: 44px 1fr; gap: 0.9rem; }
  .stage-num { width: 44px; height: 49px; font-size: 1rem; }
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row .field-narrow { flex: 1 1 auto; }
  .navuser { border-left: none; padding-left: 0; }
  .auth-logo { margin-left: auto; margin-right: auto; }
}
