@font-face {
  font-family: "Krijo Bricolage";
  src: url("/home-assets/bricolage-700.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

/* ==========================================================================
   Krijo Inside Panel & Studio IDE — Cloudflare Architectural Design System
   ========================================================================== */

body:not(:has(.krijo-home)) {
  --accent: #f6821f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(246, 130, 31, .12);
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-hover: #f5f4f0;
  --line: #e4e1d9;
  --cf-rail: #dedad0;
  --ink: #141517;
  --ink-2: #3b3e45;
  --muted: #62666f;
  --ok: #059669;
  --danger: #dc2626;
  --shadow: 0 10px 28px -16px rgba(20, 21, 23, .12);
  --cf-display: "Krijo Bricolage", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --cf-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(20, 21, 23, .065) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--ink);
}

[data-theme="dark"] body:not(:has(.krijo-home)) {
  --accent: #ff8a2b;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 138, 43, .15);
  --bg: #0b0d11;
  --surface: #12161e;
  --surface-hover: #191f2a;
  --line: #252c39;
  --cf-rail: #28303e;
  --ink: #f4f5f7;
  --ink-2: #cfd5df;
  --muted: #949dab;
  --ok: #34d399;
  --shadow: 0 14px 34px -16px rgba(0, 0, 0, .55);

  background-image: radial-gradient(circle, rgba(255, 255, 255, .045) 1px, transparent 1px);
}

/* Global Display Typography & Buttons in Panel */
body:not(:has(.krijo-home)) h1,
body:not(:has(.krijo-home)) h2,
body:not(:has(.krijo-home)) .kpi-big,
body:not(:has(.krijo-home)) .kpi-v,
body:not(:has(.krijo-home)) .price {
  font-family: var(--cf-display);
  letter-spacing: -.028em;
}

body:not(:has(.krijo-home)) .brand-mark,
body:not(:has(.krijo-home)) .studio-logo {
  background: linear-gradient(135deg, #ea580c, #f6821f 60%, #fbad41);
  color: #ffffff;
  border-radius: 7px;
  box-shadow: 0 4px 12px rgba(246, 130, 31, .28);
}

body:not(:has(.krijo-home)) .btn:not(.btn-ghost):not(.btn-google):not(.btn-danger) {
  background: linear-gradient(135deg, #ea580c 0%, #f6821f 65%, #fb923c 100%);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  font-weight: 650;
  box-shadow: 0 6px 18px -6px rgba(234, 88, 12, .42);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

body:not(:has(.krijo-home)) .btn:not(.btn-ghost):not(.btn-google):not(.btn-danger):hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -6px rgba(234, 88, 12, .52);
  filter: brightness(1.03);
}

body:not(:has(.krijo-home)) .btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
}
body:not(:has(.krijo-home)) .btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   1. App Shell: Sidebar, Credits Popover, Topbar & Command Palette
   ========================================================================== */

.sidebar {
  background: var(--surface);
  border-right: 1px dashed var(--cf-rail);
}

.sb-head {
  border-bottom: 1px dashed var(--cf-rail);
}

.sb-group {
  font: 700 .68rem/1 var(--cf-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .85rem;
  padding-top: .65rem;
  border-top: 1px dashed var(--cf-rail);
}
.sb-cta + .sb-group {
  border-top: 0;
  padding-top: .25rem;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13.8px;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.sb-link:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.sb-link.active {
  background: var(--accent-soft);
  color: #c2410c;
  border-color: rgba(246, 130, 31, .28);
  font-weight: 650;
}
[data-theme="dark"] .sb-link.active {
  color: #fbad41;
}

.sb-tag {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(246, 130, 31, .14);
  color: #ea580c;
  font: 700 10px/1.2 var(--cf-mono);
  text-transform: uppercase;
  letter-spacing: .04em;
}
[data-theme="dark"] .sb-tag {
  color: #fbad41;
}
.sidebar.collapsed .sb-tag {
  display: none;
}

.sb-footer {
  border-top: 1px dashed var(--cf-rail);
}

.sb-credits-wrap {
  width: 100%;
  position: relative;
}

.sb-credits-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-hover);
  padding: 9px 11px;
  font: inherit;
  color: var(--ink);
  transition: border-color .15s ease;
}
.sb-credits-btn:hover {
  border-color: var(--accent);
}
.sb-credits-cta {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #ea580c;
}
[data-theme="dark"] .sb-credits-cta { color: #fbad41; }

.dd-credits-pop {
  bottom: calc(100% + 8px);
  top: auto;
  left: 0;
  right: 0;
  min-width: 220px;
  padding: 12px;
}

.dd-pop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--cf-rail);
  font-size: 13px;
}

.dd-pop-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  padding: 3px 0;
}
.dd-pop-row strong { color: var(--ink); }

.app-topbar {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px dashed var(--cf-rail);
}

.cmd-btn {
  background: var(--surface-hover);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.cmd-btn:hover {
  border-color: var(--accent);
}

.kbd {
  font-family: var(--cf-mono);
}

/* ==========================================================================
   2. Architectural Cards, KPIs, Headers & Empty States
   ========================================================================== */

body:not(:has(.krijo-home)) .card,
body:not(:has(.krijo-home)) .plan {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.cf-cad-card {
  position: relative;
  border-top: 3px solid var(--accent) !important;
}

.cf-kicker-tag {
  display: inline-block;
  margin-bottom: 6px;
  font: 700 .7rem/1.2 var(--cf-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #ea580c;
}
[data-theme="dark"] .cf-kicker-tag { color: #fbad41; }

.page-head {
  padding-bottom: 1.15rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px dashed var(--cf-rail);
}

.kpi-card,
.kpi {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .18s ease, transform .18s ease;
}
.kpi-card:hover {
  border-color: rgba(246, 130, 31, .45);
  transform: translateY(-2px);
}

.project-card {
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -20px rgba(234, 88, 12, .25);
}

.proj-new-card {
  border: 1.5px dashed var(--cf-rail) !important;
  background: color-mix(in srgb, var(--surface) 60%, transparent) !important;
}
.proj-new-card:hover {
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
}

/* Dashboard Empty State Starter Duo (Mjegulla Parity + Cloudflare Sunset) */
.cf-empty-hero {
  border: 1px dashed var(--cf-rail);
  border-radius: 16px;
  padding: clamp(1.6rem, 4vw, 2.5rem);
  background:
    radial-gradient(90% 80% at 90% 10%, rgba(251, 173, 65, .18), transparent 65%),
    var(--surface);
}

.cf-empty-head {
  max-width: 56ch;
  margin-bottom: 1.5rem;
}
.cf-empty-head h2 { margin: 0 0 .4rem; }
.cf-empty-head p { margin: 0; }

.cf-starter-duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.cf-starter-card {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1.35rem;
  text-decoration: none;
  color: inherit;
  transition: transform .18s ease, border-color .18s ease;
}
.cf-starter-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.cf-starter-studio {
  background: linear-gradient(145deg, rgba(246, 130, 31, .08), rgba(251, 173, 65, .14)) !important;
  border-color: rgba(246, 130, 31, .35) !important;
}
.cf-starter-ic {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: #ea580c;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.cf-starter-go {
  margin-top: auto;
  padding-top: .4rem;
  font: 700 .82rem/1 var(--cf-mono);
  color: #ea580c;
}
[data-theme="dark"] .cf-starter-go { color: #fbad41; }

/* ==========================================================================
   3. AI Studio Prompt-First Launchpad (/studio)
   ========================================================================== */

.cf-studio-hero {
  max-width: 820px;
  margin: 1rem auto 0;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  border-radius: 18px;
  border: 1px solid rgba(246, 130, 31, .34);
  background:
    radial-gradient(circle, rgba(234, 88, 12, .12) 1px, transparent 1.2px) 0 0 / 16px 16px,
    radial-gradient(95% 85% at 85% 0%, rgba(251, 173, 65, .24), var(--surface) 68%);
  box-shadow: 0 24px 50px -26px rgba(234, 88, 12, .25);
  text-align: center;
}

.cf-studio-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(246, 130, 31, .12);
  border: 1px solid rgba(246, 130, 31, .32);
  color: #ea580c;
  font: 700 .72rem/1.2 var(--cf-mono);
  margin-bottom: .8rem;
}
[data-theme="dark"] .cf-studio-badge { color: #fbad41; }

.cf-studio-hero h1 {
  margin: 0 0 .45rem;
  font-size: clamp(1.85rem, 3.6vw, 2.7rem);
}
.cf-studio-hero > p.muted {
  max-width: 54ch;
  margin: 0 auto 1.4rem;
}

.cf-studio-composer {
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .14);
}
.cf-studio-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cf-sc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-hover);
  border-bottom: 1px dashed var(--cf-rail);
}

.cf-seg-opt {
  display: inline-flex;
  cursor: pointer;
}
.cf-seg-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cf-seg-opt span {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.cf-seg-opt input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.cf-studio-composer textarea {
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  padding: 12px 14px;
  font-size: .98rem;
  width: 100%;
}

.cf-sc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px dashed var(--cf-rail);
}

.cf-sc-name {
  max-width: 240px;
  padding: 6px 10px !important;
  font-size: 13px !important;
}

.cf-studio-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 1rem;
}

.cf-studio-chips .cf-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}
.cf-studio-chips .cf-chip:hover {
  border-color: var(--accent);
  color: #ea580c;
}

.cf-clone-drawer {
  margin-top: 1.1rem;
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--cf-rail);
  background: var(--surface);
  font-size: 13.5px;
}
.cf-clone-drawer summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-2);
}

.cf-mini-proj {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  padding: 14px 16px;
}
.cf-mini-proj:hover {
  border-color: var(--accent);
}

/* ==========================================================================
   4. Suite & Labs Layouts (Dezigner, Email, Agents, Security, Ads, Office)
   ========================================================================== */

.cf-dezigner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.4rem;
  align-items: start;
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #ea580c;
  font-weight: 650;
}

.cf-filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 1rem;
}

.cf-inbox-card.is-unread {
  border-left: 3.5px solid var(--accent);
}

.cf-inbox-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--cf-rail);
}

.cf-inbox-dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 14px;
  margin: 0;
}
.cf-inbox-dl dt {
  font: 700 .7rem/1.2 var(--cf-mono);
  text-transform: uppercase;
  color: var(--muted);
}
.cf-inbox-dl dd {
  margin: 2px 0 0;
  font-size: .92rem;
  word-break: break-word;
}

/* Agents Sandbox Chat */
.cf-sandbox-log {
  min-height: 240px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px dashed var(--cf-rail);
  display: grid;
  align-content: start;
  gap: 8px;
}

.cf-sbx-bot,
.cf-sbx-me {
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 86%;
  font-size: .9rem;
  line-height: 1.45;
}
.cf-sbx-bot {
  justify-self: start;
  background: var(--surface);
  border: 1px solid var(--line);
}
.cf-sbx-me {
  justify-self: end;
  background: var(--accent);
  color: #ffffff;
}

/* Security Audit Checks */
.cf-sec-checks {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  display: grid;
  gap: 8px;
}
.cf-sec-checks li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-hover);
}
.cf-sec-checks li.is-ok > span { color: var(--ok); font-weight: 800; }
.cf-sec-checks li.is-warn > span { color: #d97706; font-weight: 800; }
.cf-sec-checks li strong { display: block; font-size: .92rem; }
.cf-sec-checks li small { display: block; color: var(--muted); font-size: .82rem; }

.cf-sev {
  font: 700 .66rem/1 var(--cf-mono);
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

/* Ads Preview */
.cf-ad-preview {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--cf-rail);
  background: var(--surface-hover);
}

/* Referral Tiers */
.cf-tier-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.cf-tier-pill {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-hover);
  text-align: center;
}
.cf-tier-pill strong { display: block; font-size: .92rem; }
.cf-tier-pill small { font-size: .74rem; color: var(--muted); }
.cf-tier-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   5. AI Studio 4-Zone IDE Polish (Code Editor Tab + Landscape Rotate)
   ========================================================================== */

.studio-bar {
  background: var(--surface);
  border-bottom: 1px dashed var(--cf-rail);
}

.studio-rail {
  background: var(--surface);
  border-right: 1px dashed var(--cf-rail);
}

.code-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.code-editor-ta {
  width: 100%;
  min-height: calc(100dvh - 180px);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #2b3342;
  background: #0f1218 !important;
  color: #e2e8f0 !important;
  font: 12.5px/1.55 var(--cf-mono) !important;
  resize: vertical;
  tab-size: 2;
}

#frame-wrap.mobile.landscape iframe {
  width: 740px;
  max-width: 100%;
  height: 390px;
}

#frame-wrap.tablet.landscape iframe {
  width: 1024px;
  max-width: 100%;
  height: 680px;
}

/* Auth & Wizard Cloudflare Card Polish */
body:not(:has(.krijo-home)) main.narrow:not(.wizard-page):not(.legal) {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 2.2rem;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .cf-dezigner-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .cf-filter-bar {
    grid-template-columns: 1fr 1fr;
  }
}
