\/* ==========================================================================
   ComposeForge CE — styles.css (cleaned + deduplicated)
   Structure:
   1) Base
   2) Components
   3) Pages
   ========================================================================== */

/* ==========================================================================
   1) BASE
   ========================================================================== */

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

html { font-size: 16px; }

@font-face {
  font-family: "ComposeForge Headings";
  src: url("/static/fonts/grenze.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.cf-logo-text {
  font-family: "ComposeForge Headings", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

body {
  margin: 0;
  padding: 2rem 1.5rem 3rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #262626;
  background-color: #f5f5f5;
  line-height: 1.5;
}

@media (min-width: 960px) {
  body { padding: 3rem 4rem 4rem; }
}

h1 {
  margin: 0 0 0.75rem;
  font-size: 2.5rem;
  color: #101010;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.7rem;
}

h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1.25rem;
  font-weight: 600;
}

/* --- Links --------------------------------------------------------------- */
a,
.cf-nav-link,
.cf-footer-link,
.cf-link-inline {
  color: #101010;
}

a:hover,
.cf-nav-link:hover,
.cf-footer-link:hover,
.cf-link-inline:hover {
  color: #2b2a29;
}

/* --- Utilities ----------------------------------------------------------- */
.note {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: #5f6c80;
}

.hidden { display: none !important; }



/* ==========================================================================
   2) COMPONENTS
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout wrappers (legacy + current)
   -------------------------------------------------------------------------- */
.cf-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.cf-body {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

@media (min-width: 960px) {
  .cf-body { padding: 3rem 1.25rem 4rem; }
}

.cf-main { margin-top: 2rem; }

/* classic sr-only helper */
.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;
}

/* --------------------------------------------------------------------------
   Header & navigation
   -------------------------------------------------------------------------- */
.cf-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  isolation: isolate;
 /* backdrop-filter: blur(12px);*/
  background-color: inherit; /* fill sticky area */
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
}

.cf-header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cf-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cf-logo-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cf-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.9rem;
  font-size: 1.2rem;
  font-weight: 600;
  background: rgba(43, 42, 41, 0.06);
}

.cf-logo-text {
  font-family: "ComposeForge Headings";
  display: flex;
  flex-direction: column;
  /* font-size: 2.5rem; */
  font-size: clamp(1.5rem, 3.8vw, 2.5rem);
}

.cf-logo-title {
  font-weight: 650;
  letter-spacing: 0.03em;
}

.cf-logo-subtitle {
  font-size: 0.78rem;
  opacity: 0.75;
}

.cf-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.cf-logo {
  height: 52px;
  width: auto;
  max-width: 100%;
}

.cf-theme-toggle,
.cf-nav-toggle {
  color: inherit;
}

.cf-nav-icon, .cf-theme-icon, .cf-account-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Desktop nav */
.cf-nav {
  display: flex;
  gap: 0.75rem;
  font-size: 0.9rem;
}

@media (min-width: 769px) {
  .cf-header-right { gap: 0.75rem; }
  .cf-nav { margin-right: 0.25rem; }
}

.cf-nav-link {
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  opacity: 0.8;
}

.cf-nav-link:hover {
  opacity: 1;
  background: rgba(43, 42, 41, 0.05);
}

.cf-nav-link-active {
  font-weight: 600;
  background: rgba(43, 42, 41, 0.08);
  opacity: 1;
}

/* Theme toggle button: static bg, same in both dark/light */
.cf-theme-toggle {
  border-radius: 999px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  background: transparent;
  cursor: pointer;
  line-height: 1;
  border: 2px solid rgba(254, 254, 254, 0.6);
}

.cf-theme-toggle:hover {
  background: inherit; 
  color: inherit;
  border: 2px solid #f07500;
  box-shadow: 0 6px 14px rgb(240, 117, 0, 0.25);
}


/* Mobile nav toggle (hamburger) */
.cf-nav-toggle {
  display: none; /* shown only on small screens */
  border: 0px solid #2b2a29;
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  font-size: 1rem;
  background: transparent;
  cursor: pointer;
  line-height: 1;
  color: #101010; /* force visibility in light mode */
}

.cf-nav-toggle:hover { background: transparent; }

/* Mobile layout: collapse nav into dropdown */
@media (max-width: 990px) {
  .cf-nav {
    display: none;
    position: absolute;
    right: 1.25rem;
    top: 100%;
    margin-top: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 2px solid #fff;
    background: #f5f5f5;
  }

  .cf-header-nav-open .cf-nav { display: flex; }

  .cf-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Login and logout buttons  */
.cf-auth-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.cf-logout-form {
  margin: 0;
}

.cf-nav-link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: #101010; /* force visibility in light mode */
}

.cf-icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: auto;
  height:36px;
  border-radius:999px;
  background:inherit;
  color: inherit;
  border: 2px solid transparent;
  cursor:pointer;
}

.cf-icon-btn:hover {
  background: transparent;
  color: inherit;
  border: 2px solid #f07500;
  box-shadow: 0 6px 14px rgb(240, 117, 0, 0.25);
}

.cf-account{ position:relative; display:inline-flex; }

.cf-account-label{ font-size:.75rem; opacity:.75; }

.cf-account-value{ font-size:.9rem; }

.cf-account-action{
  display: block; 
  width: auto;
  text-align: left;
  background: inherit; 
  border: 2px solid transparent;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  font: inherit;
  border-radius: 999px;
  padding: 10px;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  color: inherit;
}

.cf-account-action:hover{
  background: inherit; 
  color: inherit;
  border: 2px solid #f07500;
  box-shadow: 0 6px 14px rgb(240, 117, 0, 0.25);
}

/* Make the account "button" behave like a pill with inline icon+text */
.cf-account-pill {
  border: 2px solid rgba(254, 254, 254, 0.6);
  padding: 0rem 0.6rem;
  font-size: 0.9rem;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none; /* since it's an <a> */
  border-radius: 999px;
  line-height: 1;
  min-height: 34px;          /* optional: consistent tap target */
}

/* Ensure the svg actually behaves like an icon */
.cf-account-svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}



/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.cf-hero { padding: 2rem 0 1.5rem; }

/* Legacy hero helper (kept for older pages) */
.cf-hero-text h1 { margin-bottom: 0.5rem; }
.cf-hero-subtitle { margin-bottom: 1rem; max-width: 40rem; }

.cf-hero-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cf-hero-copy h1 {
  font-size: 2.2rem;
  margin: 0 0 0.75rem;
}

@media (min-width: 768px) {
  .cf-hero-copy h1 { font-size: 2.4rem; }
}

.cf-hero-lead {
  margin: 0 0 1.25rem;
  font-size: 1.3rem;
}

.cf-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.cf-hero-note {
  font-size: 1rem;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Sections & grids
   -------------------------------------------------------------------------- */
.cf-section {
  margin-top: 2.5rem; /* legacy spacing */
  padding: 1.75rem 0 1.5rem;
  border-top: 2px solid #f07500;
}

.cf-section-header { margin-bottom: 1.5rem; }
.cf-section-header h2 { margin: 0 0 0.3rem; font-size: 1.5rem; }
.cf-section-subtitle {
  margin: 0;
  font-size: 1rem;
  opacity: 0.9;
  max-width: 36rem;
  color: #777; /* matches older subtitle tone */
}
.cf-section-footer { margin-top: 1rem; }

.cf-link-inline { font-size: 1rem; }

.cf-grid { display: grid; gap: 1rem; }
.cf-grid-2 { grid-template-columns: 1fr; }
.cf-grid-3 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .cf-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cf-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   Cards (general)
   -------------------------------------------------------------------------- */
.cf-card {
  border-radius: 1rem;
  padding: 1.1rem 1.1rem 1rem;
  /*  border: 2px solid rgba(220, 220, 220, 0.4); */
  box-shadow: 0 3px 10px rgba(43, 42, 41, 0.15);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cf-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cf-card h3 { margin: 0; font-size: 1.25rem; }
.cf-card p { margin: 0; font-size: 1rem; }

.cf-card-list {
  margin: 0.25rem 0 0.8rem;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  height: 100px;
}

.cf-card-list li { margin-bottom: 0.15rem; }

/* Edition card accents */
.cf-card-ce { border-left: 4px solid #22c55e; }
.cf-card-pro { border-left: 4px solid #f97316; }
.cf-card-np { border-left: 4px solid #0ea5e9; }


/* Mini cards */
.cf-mini-card {
  border-radius: 0.9rem;
  padding: 0.9rem 0.95rem;
  /*  border: 2px solid rgba(220, 220, 220, 0.6); */
  box-shadow: 0 3px 10px rgba(43, 42, 41, 0.15);
  background: rgba(248, 250, 252, 0.9);
}

.cf-mini-card h3 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.cf-mini-card p { margin: 0; font-size: 1rem; }

/* --------------------------------------------------------------------------
   Stack grids & cards (new + legacy)
   -------------------------------------------------------------------------- */

/* Legacy CF stack grid (for any older pages) */
.cf-stacks-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* Legacy CF stack card (re-skinned to feel like new cards) */
.cf-stack-card {
  border-radius: 10px;
  /* border: 2px solid #dcdcdc; */
  background-color: #fff;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 10px rgba(43, 42, 41, 0.15);
  font-size: 0.9rem;
}

.cf-stack-card h3 { margin: 0 0 0.25rem; font-size: 1.25rem; }

.cf-stack-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.cf-stack-name { margin: 0; font-size: 1.1rem; }

.cf-stack-category {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.cf-stack-description { margin: 0.25rem 0 0.75rem; }

.cf-stack-tags {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cf-tag-pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 2px solid #555;
}

.cf-stack-footer { margin-top: auto; }

/* Stack category accent borders (builder + homepage helpers) */
.cf-stack-edge  { border-left: 4px solid #0ea5e9 !important; } /* Edge & Network */
.cf-stack-ops   { border-left: 4px solid #a855f7 !important; } /* Ops & Admin */
.cf-stack-sites { border-left: 4px solid #3b82f6 !important; } /* Sites & Knowledge */
.cf-stack-files { border-left: 4px solid #14b8a6 !important; } /* Files & Sync */
.cf-stack-work  { border-left: 4px solid #f07500 !important; } /* Work & Business (brand accent) */
.cf-stack-media { border-left: 4px solid #22c55e !important; } /* Media & Fun */
.cf-stack-data  { border-left: 4px solid #64748b !important; } /* Data Stores */

/* New stack grids/cards for ce_home.html + builder.html */
.stack-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* 1 column by default */
  gap: 1.1rem;
  margin-top: 0.9rem;
}

@media (min-width: 900px) {
  .stack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stack-card {
  border-radius: 10px;
  border: 2px solid #d0d7e2;
  background-color: #f5f5f5;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 6px rgba(43, 42, 41, 0.06);
}

.stack-card-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.stack-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.stack-card-toggle input[type="checkbox"] { margin: 0; }

.stack-card-description {
  margin: 0.25rem 0 0.4rem;
  font-size: 0.9rem;
  color: #4b5563;
}

.stack-card-meta {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: #6b7280;
}

.stack-card-body { margin-top: 0.4rem; }
.stack-card-body label { margin-top: 0.35rem; }

/* Gentle variety for stacked cards (optional visual interest) */
.stack-grid .stack-card:nth-child(1) { border-color: #0ea5e9; background-color: #262626; }
.stack-grid .stack-card:nth-child(2) { border-color: #a855f7; background-color: #262626; }
.stack-grid .stack-card:nth-child(3) { border-color: #3b82f6; background-color: #262626; }
.stack-grid .stack-card:nth-child(4) { border-color: #14b8a6; background-color: #262626; }
.stack-grid .stack-card:nth-child(5) { border-color: #f07500; background-color: #262626; }
.stack-grid .stack-card:nth-child(6) { border-color: #22c55e; background-color: #262626; }
.stack-grid .stack-card:nth-child(7) { border-color: #64748b; background-color: #262626; }

/* Accent borders (match builder categories) */
.stack-card--edge  { border-left: 4px solid #0ea5e9 !important; } /* Edge & Network */
.stack-card--ops   { border-left: 4px solid #a855f7 !important; } /* Ops & Admin */
.stack-card--sites { border-left: 4px solid #3b82f6 !important; } /* Sites & Knowledge */
.stack-card--files { border-left: 4px solid #14b8a6 !important; } /* Files & Sync */
.stack-card--work  { border-left: 4px solid #f07500 !important; } /* Work & Business (brand accent) */
.stack-card--media { border-left: 4px solid #22c55e !important; } /* Media & Fun */
.stack-card--data  { border-left: 4px solid #64748b !important; } /* Data Stores */

/* ------------------------------
   Builder: show fields only when selected
------------------------------ */

/* Hide the editable fields by default */
.cf-stack-card .cf-stack-body {
  display: none;
}

/* Show editable fields only when the stack is selected */
.cf-stack-card.is-selected .cf-stack-body {
  display: flex; /* your cf-stack-body uses flex + gap */
}

.cf-stack-card.is-selected {
  box-shadow: 0 10px 25px rgba(43, 42, 41, 0.10);
}


/* --------------------------------------------------------------------------
   Forms & fieldsets
   -------------------------------------------------------------------------- */
form {
  max-width: 960px;
  margin: 0 auto;
}

fieldset {
  border: 2px solid #d0d7e2;
  border-radius: 10px;
  padding: 1.2rem 1.2rem 1.4rem;
  margin: 0 0 1.5rem;
  background-color: #f5f5f5;
}

legend {
  padding: 0 0.4rem;
  font-weight: 600;
  font-size: 1rem;
  color: #101827;
}

/* All labels: name above input */
label {
  display: block;
  font-size: 0.95rem;
  color: #777;
}

/* Inline labels like checkboxes/radios */
label > input[type="checkbox"],
label > input[type="radio"] { margin-right: 0.35rem; }

/* Top-level labels directly under a fieldset (for simple checklists) */
fieldset > label { margin-top: 0.3rem; }

/* Row/grid layout */
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem 1.25rem;
  margin-top: 0.75rem;
}

.row > label { min-width: 0; }

@media (min-width: 900px) {
  .row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Inputs & controls */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"] {
  display: block;
  width: auto;
  margin-top: 0.35rem;
  padding: 0.55rem 0.6rem;
  border-radius: 7px;
  border: 2px solid #c4ccd9;
  background-color: #f5f5f5;
  font: inherit;
  color: #101010;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input::placeholder { color: #9aa5b5; }

input:focus {
  border-color: #2b2a29;
  background-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Password containers */
[data-password-container] {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

[data-password-container] input[type="password"],
[data-password-container] input[type="text"] {
  flex: 1 1 auto;
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Buttons (native buttons) + status feedback
   -------------------------------------------------------------------------- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 2px solid #2b2a29;
  background-color: #2b2a29;
  color: #f5f5f5;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

button:hover {
  background-color: #2b2a29;
  border-color: #2b2a29;
  box-shadow: 0 6px 14px rgb(43, 42, 41, 0.25) /* rgba(37, 99, 235, 0.25); */
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 3px 8px rgba(43, 42, 41, 0.2);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

/* Secondary buttons (for regenerate/copy in legacy password containers) */
button.btn-secondary,
[data-password-container] button {
  border-color: #c4ccd9;
  background-color: #ffffff;
  color: #273341;
  box-shadow: none;
}

button.btn-secondary:hover,
[data-password-container] button:hover {
  border-color: #9aa5b5;
  background-color: #f3f5f9;
  box-shadow: 0 2px 6px rgba(254, 254, 254, 0.35);
}

/* Visual feedback for "copied" state */
[data-action="copy-password"][data-copied="true"]::after {
  content: "Copied!";
  margin-left: 0.4rem;
  font-size: 0.8rem;
  color: #059669;
}

/* Submit button spacing */
form > button[type="submit"] { margin-top: 0.75rem; }

/* Status text */
#status {
  display: inline-block;
  margin-left: 0.75rem;
  font-size: 0.9rem;
  color: #4b5563;
}

/* Inline status (used near copy/regenerate buttons) */
.cf-inline-status {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  color: #10b981;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* --------------------------------------------------------------------------
   Buttons (CF-style: anchors + small variants)
   -------------------------------------------------------------------------- */
.cf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 500;
  background: transparent;
  color: inherit;
  border: 2px solid #999;
  text-decoration: none;
  cursor: pointer;
}

.cf-btn:hover {
  background: transparent;
  color: inherit;
  border: 2px solid #f07500;
  box-shadow: 0 6px 14px rgb(240, 117, 0, 0.25);
}

.cf-btn-primary:hover {
  border: 2px solid #f07500;
  box-shadow: 0 6px 14px rgb(240, 117, 0, 0.25);
}

.cf-btn-secondary:hover {
  border: 2px solid #f07500;
  box-shadow: 0 6px 14px rgb(240, 117, 0, 0.25);
}

.cf-btn-ghost:hover {
  border-color: #f07500;
  box-shadow: 0 6px 14px rgb(240, 117, 0, 0.25);
}

.cf-btn-block { width: auto; justify-content: center; }

/* Legacy cf-button helpers (kept for older pages) */
.cf-button {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 2px solid #555;
  text-decoration: none;
  font-size: 0.9rem;
}
.cf-button-primary { background: #fff; }
.cf-button-secondary { background: transparent; }

/* --------------------------------------------------------------------------
   Ephemeral notice
   -------------------------------------------------------------------------- */
[data-role="ephemeral-notice"] {
  max-width: 970px;
  margin: 0 auto 1.25rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 2px solid #facc15;
  background-color: #fef9c3;
  color: #854d0e;
}
[data-role="ephemeral-notice"] strong { font-weight: 600; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.cf-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 2px solid transparent;
  white-space: nowrap;
}

.cf-badge-ce {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(22, 163, 74, 0.07);
}

.cf-badge-pro {
  border-color: rgba(249, 115, 22, 0.5);
  background: rgba(248, 153, 60, 0.07);
}

.cf-badge-np {
  border-color: rgba(14, 165, 233, 0.5);
  background: rgba(14, 165, 233, 0.08);
}

/* -------------------------------------------------------------------------
   Builder sticky action bar
   ------------------------------------------------------------------------- */

.theme-dark .cf-actionbar {
  /* background: rgba(15, 18, 22, 0.85); /* matches dark mode vibe */
  border-top: 2px solid rgba(255, 255, 255, 0.14);
}

.cf-actionbar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  padding: 0.75rem;
  margin-top: 1.25rem;
  /* background: rgba(245, 247, 250, 0.9); /* matches light bg vibe */
  backdrop-filter: blur(10px);
  border-top: 2px solid rgba(31, 41, 51, 0.12);
}

.cf-actionbar-inner {
  max-width: 1100px; /* adjust if your site uses a different max */
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.cf-actionbar-left {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.cf-actionbar-right {
  min-width: 220px;
  text-align: right;
}

.cf-actionbar-status {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Ensure the bar doesn't cover the last content on short screens */
.cf-builder {
  padding-bottom: 4.5rem;
}


/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.cf-footer {
  border-top: 2px solid rgba(254, 254, 254, 0.35);
  margin-top: 2rem;
  padding-top: 1rem;
  font-size: 0.85rem;
}

.cf-footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .cf-footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.cf-footer-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cf-license-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 2px solid rgba(254, 254, 254, 0.9);
}

.cf-license-label { opacity: 0.85; }
.cf-license-tag { font-weight: 600; }

.cf-footer-right { display: flex; gap: 0.75rem; }
.cf-footer-link { text-decoration: none; }

/* --------------------------------------------------------------------------
   Dark mode (system) + explicit theme overrides
   -------------------------------------------------------------------------- */

/* System dark mode default (unless theme-light is set) */
@media (prefers-color-scheme: dark) {
  body:not(.theme-light),
  html:not(.theme-light) body {
    background-color: #101010;
    color: #f5f5f5;
  }

  html:not(.theme-light) .cf-logo-mark {
    background: rgba(254, 254, 254, 0.16);
  }

  html:not(.theme-light) .cf-nav-link:hover,
  html:not(.theme-light) .cf-nav-link.cf-nav-link-active {
    background: rgba(43, 42, 41, 0.9);
  }

  html:not(.theme-light) .cf-card,
  html:not(.theme-light) .cf-mini-card,
  html:not(.theme-light) .cf-stack-card {
    background: #2b2a29;
    border-color: rgba(51, 65, 85, 0.9);
  }

  html:not(.theme-light) .cf-section {
    border-top-color: rgba(255, 94, 0, 0.7);
  }

  /* html:not(.theme-light) .cf-btn-secondary,
  html:not(.theme-light) .cf-btn-ghost {
    border-color: rgba(254, 254, 254, 0.8);
  } */

  html:not(.theme-light) .cf-footer {
    border-top-color: rgba(31, 41, 55, 0.9);
  }

  html:not(.theme-light) .cf-license-badge {
    border-color: rgba(254, 254, 254, 0.9);
  }

  /* Links in dark mode */
  html:not(.theme-light) a,
  html:not(.theme-light) .cf-nav-link,
  html:not(.theme-light) .cf-footer-link,
  html:not(.theme-light) .cf-link-inline {
    color: #f5f5f5;
  }

  html:not(.theme-light) a:hover,
  html:not(.theme-light) .cf-nav-link:hover,
  html:not(.theme-light) .cf-footer-link:hover,
  html:not(.theme-light) .cf-link-inline:hover {
    color: #ffffff;
  }

  /* Hero heading contrast in dark */
  html:not(.theme-light) .cf-hero-copy h1 { color: #f5f5f5; }

  /* Mobile nav background in dark */
  @media (max-width: 768px) {
    html:not(.theme-light) .cf-nav {
      background: #101010;
      border-color: rgba(51, 65, 85, 0.9);
    }
  }

  /* Inline status in dark */
  html:not(.theme-light) .cf-inline-status { color: #4ade80; }
}

/* Explicit theme overrides from the toggle */
html.theme-dark body { background-color: #101010; color: #f5f5f5; }
html.theme-dark .cf-logo-mark { background: rgba(254, 254, 254, 0.16); }

html.theme-dark .cf-nav-link:hover,
html.theme-dark .cf-nav-link.cf-nav-link-active {
  background: rgba(43, 42, 41, 0.9);
}

html.theme-dark .cf-nav-toggle { color: #f5f5f5; }

html.theme-dark .cf-card,
html.theme-dark .cf-mini-card,
html.theme-dark .cf-stack-card {
  background: #2b2a29;
  border-color: rgba(51, 65, 85, 0.9);
}

html.theme-dark .cf-section { border-top-color: rgba(255, 94, 0, 0.7); }

/* html.theme-dark .cf-btn-secondary,
html.theme-dark .cf-btn-ghost {
  border-color: rgba(254, 254, 254, 0.8);
} */

html.theme-dark .cf-footer { border-top-color: rgba(31, 41, 55, 0.9); }

html.theme-dark .cf-license-badge { border-color: rgba(254, 254, 254, 0.9); }

html.theme-dark a,
html.theme-dark .cf-nav-link,
html.theme-dark .cf-footer-link,
html.theme-dark .cf-link-inline {
  color: #f5f5f5;
}

/* html.theme-dark a:hover,
html.theme-dark .cf-nav-link:hover,
html.theme-dark .cf-footer-link:hover,
html.theme-dark .cf-link-inline:hover {
  color: #ffffff;
} */

html.theme-dark .cf-hero-copy h1 { color: #f5f5f5; }
html.theme-dark .cf-inline-status { color: #4ade80; }

/* Force light theme when explicitly chosen */
html.theme-light body {
  background-color: #f5f7fa;
  color: #1f2933;
}

/* Preserve accent border colors in dark mode */
html.theme-dark .cf-card-ce { border-left-color: #22c55e; }
html.theme-dark .cf-card-pro { border-left-color: #f97316; }
html.theme-dark .cf-card-np { border-left-color: #0ea5e9; }

html.theme-dark .cf-stack-edge  { border-left-color: #0ea5e9 !important; }
html.theme-dark .cf-stack-ops   { border-left-color: #a855f7 !important; }
html.theme-dark .cf-stack-sites { border-left-color: #3b82f6 !important; }
html.theme-dark .cf-stack-files { border-left-color: #14b8a6 !important; }
html.theme-dark .cf-stack-work  { border-left-color: #f07500 !important; }
html.theme-dark .cf-stack-media { border-left-color: #22c55e !important; }
html.theme-dark .cf-stack-data  { border-left-color: #64748b !important; }

@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-card-ce { border-left-color: #22c55e; }
  html:not(.theme-light) .cf-card-pro { border-left-color: #f97316; }
  html:not(.theme-light) .cf-card-np { border-left-color: #0ea5e9; }

  html:not(.theme-light) .cf-stack-edge  { border-left-color: #0ea5e9 !important; }
  html:not(.theme-light) .cf-stack-ops   { border-left-color: #a855f7 !important; }
  html:not(.theme-light) .cf-stack-sites { border-left-color: #3b82f6 !important; }
  html:not(.theme-light) .cf-stack-files { border-left-color: #14b8a6 !important; }
  html:not(.theme-light) .cf-stack-work  { border-left-color: #f07500 !important; }
  html:not(.theme-light) .cf-stack-media { border-left-color: #22c55e !important; }
  html:not(.theme-light) .cf-stack-data  { border-left-color: #64748b !important; }
}

.cf-logo--dark { display: none; }

/* System dark mode (when no explicit light theme is chosen) */
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-logo--light { display: none; }
  html:not(.theme-light) .cf-logo--dark  { display: inline-block; }
}

/* Your explicit theme toggle uses html.theme-dark */
html.theme-dark .cf-logo--light { display: none; }
html.theme-dark .cf-logo--dark  { display: inline-block; }

/* Explicit light mode forces light logo */
html.theme-light .cf-logo--light { display: inline-block; }
html.theme-light .cf-logo--dark  { display: none; }


/* ==========================================================================
   3) PAGES
   ========================================================================== */

/* --------------------------------------------------------------------------
   Builder page layout tweaks
   -------------------------------------------------------------------------- */
.cf-hero--compact { padding: 1.25rem 0 0.75rem; }
.cf-section--tight { padding: 1.25rem 0 1.1rem; }

.cf-form { margin-top: 0.5rem; }
.cf-form-card { gap: 0.9rem; }
.cf-form-grid { gap: 0.9rem; }

.cf-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.cf-input {
  width: auto;
  padding: 0.55rem 0.65rem;
  border-radius: 0.75rem;
  border: 2px solid #ddd;
  background: #f5f5f5;
  color: inherit;
}

.cf-input:focus {
  outline: none;
  border-color: #bbb;
}

.cf-check {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.92rem;
}

.cf-callout {
  border-radius: 0.9rem;
  padding: 0.85rem 0.95rem;
  border: 2px solid rgba(254, 254, 254, 0.5);
  background: rgba(254, 254, 254, 0.08);
}

.cf-callout-warning { border-left: 4px solid #f97316; }

/* --------------------------------------------------------------------------
   Builder: Resource hints + totals panel (display-only)
   -------------------------------------------------------------------------- */

.cf-totals { margin-top: 1.25rem; }

.cf-totals-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cf-totals-title {
  margin: 0;
  font-size: 1.05rem;
}

/* Inline checkbox label variant used in totals header */
.cf-check--inline { margin: 0; }

.cf-totals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .cf-totals-grid { grid-template-columns: 1fr; }
}

.cf-totals-item {
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
}

html.theme-dark .cf-totals-item,
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-totals-item { background: rgba(255, 255, 255, 0.06); }
}

.cf-totals-label {
  font-size: 0.85rem;
  opacity: 0.8;
}

.cf-totals-value {
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 0.15rem;
}

.cf-totals-note {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  opacity: 0.85;
}

.cf-stack-resources {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px solid rgba(0, 0, 0, 0.08);
}

html.theme-dark .cf-stack-resources,
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-stack-resources { border-top-color: rgba(255, 255, 255, 0.12); }
}

.cf-stack-resources-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.cf-stack-resources-note {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Small badge used for "Bursty" stacks */
.cf-badge { display: inline-flex; align-items: center; padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.cf-badge-warn { background: rgba(245, 158, 11, 0.18); color: inherit; border: 2px solid rgba(245, 158, 11, 0.35); }

/* Builder stack cards: "card" feel (kept as-is) */
.cf-stack-grid { gap: 1rem; }

.cf-stack-card {
  border-radius: 1rem;
  padding: 1rem;
  /*border: 2px solid rgba(254, 254, 254, 0.4);*/
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Title row with checkbox */
.cf-stack-toggle {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.cf-stack-title { font-weight: 650; }

.cf-stack-desc {
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.95;
}

.cf-stack-meta {
  margin: 0;
  font-size: 0.86rem;
  opacity: 0.9;
}

.cf-stack-body {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Password row + small buttons */
.cf-password-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.cf-btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

.cf-note { font-size: 0.9rem; opacity: 0.9; }

/* Build footer */
.cf-build-footer { border-top: none; padding-top: 0.5rem; }

.cf-build-actions {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Center hero content on builder page */
.cf-builder .cf-hero { text-align: center; }
.cf-builder .cf-hero-inner { align-items: center; }
.cf-builder .cf-hero-copy { max-width: 50rem; }
.cf-builder .cf-hero-copy h1 { margin-left: auto; margin-right: auto; text-align: center; }
.cf-builder .cf-hero-lead { margin-left: auto; margin-right: auto; }

/* Builder cards + inputs in dark mode */
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-stack-card,
  html:not(.theme-light) .cf-form-card {
    background: #2b2a29;
   /* border-color: rgba(51, 65, 85, 0.9); */
  }

  html:not(.theme-light) .cf-input {
    border-color: rgba(51, 65, 85, 0.9);
  }
}

html.theme-dark .cf-stack-card,
html.theme-dark .cf-form-card {
  background: #2b2a29;
  /* border-color: rgba(51, 65, 85, 0.9); */
}

html.theme-dark .cf-input { border-color: rgba(51, 65, 85, 0.9); }

/* Builder category accent borders (force wins even if border shorthand exists) */
.cf-stack-card.stack-card--edge  { border-left: 4px solid #0ea5e9 !important; } /* Edge & Network */
.cf-stack-card.stack-card--ops   { border-left: 4px solid #a855f7 !important; } /* Ops & Admin */
.cf-stack-card.stack-card--sites { border-left: 4px solid #3b82f6 !important; } /* Sites & Knowledge */
.cf-stack-card.stack-card--files { border-left: 4px solid #14b8a6 !important; } /* Files & Sync */
.cf-stack-card.stack-card--work  { border-left: 4px solid #f07500 !important; } /* Work & Business (brand accent) */
.cf-stack-card.stack-card--media { border-left: 4px solid #22c55e !important; } /* Media & Fun */
.cf-stack-card.stack-card--data  { border-left: 4px solid #64748b !important; } /* Data Stores */

@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-stack-card.stack-card--edge  { border-left-color: #0ea5e9 !important; } /* Edge & Network */
  html:not(.theme-light) .cf-stack-card.stack-card--ops   { border-left-color: #a855f7 !important; } /* Ops & Admin */
  html:not(.theme-light) .cf-stack-card.stack-card--sites { border-left-color: #3b82f6 !important; } /* Sites & Knowledge */
  html:not(.theme-light) .cf-stack-card.stack-card--files { border-left-color: #14b8a6 !important; } /* Files & Sync */
  html:not(.theme-light) .cf-stack-card.stack-card--work  { border-left-color: #f07500 !important; } /* Work & Business (brand accent) */
  html:not(.theme-light) .cf-stack-card.stack-card--media { border-left-color: #22c55e !important; } /* Media & Fun */
  html:not(.theme-light) .cf-stack-card.stack-card--data  { border-left-color: #64748b !important; } /* Data Stores */
}

html.theme-dark .cf-stack-card.stack-card--edge  { border-left-color: #0ea5e9 !important; } /* Edge & Network */
html.theme-dark .cf-stack-card.stack-card--ops   { border-left-color: #a855f7 !important; } /* Ops & Admin */
html.theme-dark .cf-stack-card.stack-card--sites { border-left-color: #3b82f6 !important; } /* Sites & Knowledge */
html.theme-dark .cf-stack-card.stack-card--files { border-left-color: #14b8a6 !important; } /* Files & Sync */
html.theme-dark .cf-stack-card.stack-card--work  { border-left-color: #f07500 !important; } /* Work & Business (brand accent) */
html.theme-dark .cf-stack-card.stack-card--media { border-left-color: #22c55e !important; } /* Media & Fun */
html.theme-dark .cf-stack-card.stack-card--data  { border-left-color: #64748b !important; } /* Data Stores */

/* Dark mode input toning (builder page) */
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-builder .cf-input {
    background-color: rgba(43, 42, 41, 0.6);
    color: #f5f5f5;
    border-color: rgba(51, 65, 85, 0.9);
  }

  html:not(.theme-light) .cf-builder .cf-input::placeholder {
    color: rgba(254, 254, 254, 0.7);
  }

  html:not(.theme-light) .cf-builder .cf-input:focus {
    background-color: rgba(43, 42, 41, 0.85);
    border-color: #f5f5f5;
  }
}

html.theme-dark .cf-builder .cf-input {
  background-color: rgba(43, 42, 41, 0.6);
  color: #f5f5f5;
  border-color: rgba(51, 65, 85, 0.9);
}

html.theme-dark .cf-builder .cf-input::placeholder {
  color: rgba(254, 254, 254, 0.7);
}

html.theme-dark .cf-builder .cf-input:focus {
  background-color: rgba(43, 42, 41, 0.85);
  border-color: #f5f5f5;
}

/* Password action buttons (Copy / Regenerate) */
.cf-password-row .cf-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 0.6rem;
  background-color: rgba(254, 254, 254, 0.15);
  border: 2px solid rgba(254, 254, 254, 0.4);
  color: inherit;
  white-space: nowrap;
}

.cf-password-row .cf-btn:hover {
  background-color: rgba(254, 254, 254, 0.25);
  border-color: rgba(254, 254, 254, 0.6);
}

.cf-password-row .cf-btn:active {
  background-color: rgba(254, 254, 254, 0.35);
}

@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .cf-password-row .cf-btn {
    background-color: rgba(51, 65, 85, 0.6);
    border-color: rgba(71, 85, 105, 0.8);
    color: #f5f5f5;
  }

  html:not(.theme-light) .cf-password-row .cf-btn:hover {
    background-color: rgba(71, 85, 105, 0.8);
  }
}

html.theme-dark .cf-password-row .cf-btn {
  background-color: rgba(51, 65, 85, 0.6);
  border-color: rgba(71, 85, 105, 0.8);
  color: #f5f5f5;
}

html.theme-dark .cf-password-row .cf-btn:hover {
  background-color: rgba(71, 85, 105, 0.8);
}

/* --------------------------------------------------------------------------
   Small-screen tweaks
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  body { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.8rem; }
  fieldset { padding: 1rem 0.9rem 1.1rem; }
  .row { gap: 0.6rem; }
}
