/* ===========================================================================
   CivilKit Fab - design tokens, base + a focused, token-mapped utility layer.
   Same Open Props layer, DM Sans font and "ink"/steel-blue palette as Studio,
   so Fab reads as the same product family. Buildless + fully offline: no
   Tailwind CDN, no Google Fonts - everything is vendored.

   The utility layer below is a small, deliberately-scoped set (only what the
   Fab pages use) mapped onto CivilKit tokens - so neutral greys resolve to the
   "ink" scale and every accent resolves to the CivilKit steel-blue.
   =========================================================================== */
@layer props, reset, tokens, base, components, utilities;
@import url("../web_demo/vendor/open-props.min.css") layer(props);

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../web_demo/vendor/fonts/dmsans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../web_demo/vendor/fonts/dmsans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@layer tokens {
  :root {
    /* CivilKit ink scale (shared with Studio/marketing) */
    --ink-900: #0e0e0e; --ink-800: #171d21; --ink-700: #2e2e2e; --ink-600: #5a5a5a;
    --ink-500: #888888; --ink-400: #afafaf; --ink-300: #dddddd; --ink-200: #e9e9e9;
    --ink-100: #f5f5f5; --ink-50: #f9f9fa;
    --track-tightest: -0.04em;
    --track-tight: -0.02em;

    /* Light app surfaces */
    --bg-0: #f8fafc;       /* page background */
    --bg-1: #ffffff;       /* panels/cards */
    --bg-2: #f1f5f9;       /* panel headers / subtle stripes */
    --bg-3: #e2e8f0;       /* inputs / hover */
    --bg-4: #cbd5e1;       /* active / pressed */
    --line: #e2e8f0;       /* borders */
    --line-2: #cbd5e1;
    --txt-0: #0f172a;      /* primary text */
    --txt-1: #475569;      /* secondary */
    --txt-2: #64748b;      /* muted */
    --txt-3: #94a3b8;      /* faint / placeholder */
    --accent: #5b9bd5;     /* CivilKit steel-blue (Studio accent) */
    --accent-2: #3f7fbf;
    --accent-cta: #2563eb; /* solid CTA */
    --accent-cta-2: #1d4ed8;
    --accent-soft: #dbeafe;
    --accent-soft-2: #eff6ff;
    --accent-ink: #1d4ed8;   /* accent text on light */
    --ink-deep: #0f172a;     /* hero / footer dark surface */
    --ink-deep-2: #1e293b;
    --ok: #16a34a;
    --ok-soft: #dcfce7;
    --ok-ink: #15803d;
    --warn: #d97706;
    --warn-soft: #fef3c7;
    --warn-ink: #b45309;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --danger-ink: #b91c1c;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow: 0 6px 24px rgba(15,23,42,.08);
    --shadow-lg: 0 12px 36px rgba(15,23,42,.12);
    --radius-sm: 5px;
    --radius: 7px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-pill: 999px;
    --h-top: 48px;

    font-synthesis: none;
  }
}

@layer reset {
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    background: var(--bg-0);
    color: var(--txt-0);
    font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
  }
  /* unstyle bare buttons (Tailwind used to provide this; component/utility classes re-style) */
  button { background: none; border: 0; cursor: pointer; }
  button:disabled { cursor: not-allowed; }
  a { color: var(--accent-cta); text-decoration: none; }
  a:hover { text-decoration: none; }
  svg { display: block; }
  ::-webkit-scrollbar { width: 9px; height: 9px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }
}

@layer base {
  h1, h2, h3, h4 { letter-spacing: var(--track-tightest); font-weight: 700; }
  [x-cloak] { display: none !important; }
  ::placeholder { color: var(--txt-3); }
}

/* ===========================================================================
   UTILITY LAYER - compact, token-mapped. Class names mirror the small Tailwind
   subset the pages used, so neutral/accent colours resolve to CivilKit tokens
   automatically and nothing depends on an external framework.
   =========================================================================== */
@layer utilities {
  /* display */
  .block { display: block; } .inline-block { display: inline-block; }
  .hidden { display: none; }
  .flex { display: flex; } .inline-flex { display: inline-flex; }
  .grid { display: grid; }
  .flex-col { flex-direction: column; }
  .flex-wrap { flex-wrap: wrap; }
  .flex-1 { flex: 1 1 0%; } .flex-none { flex: none; }
  .shrink-0 { flex-shrink: 0; }
  .items-center { align-items: center; } .items-start { align-items: flex-start; }
  .items-end { align-items: flex-end; } .items-stretch { align-items: stretch; }
  .self-start { align-self: flex-start; }
  .justify-center { justify-content: center; } .justify-between { justify-content: space-between; }
  .justify-end { justify-content: flex-end; } .justify-start { justify-content: flex-start; }
  .grid-cols-1 { grid-template-columns: repeat(1,minmax(0,1fr)); }
  .grid-cols-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .grid-cols-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .grid-cols-5 { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .col-span-2 { grid-column: span 2 / span 2; }

  /* gap */
  .gap-1 { gap: 4px; } .gap-1\.5 { gap: 6px; } .gap-2 { gap: 8px; }
  .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
  .gap-x-2 { column-gap: 8px; } .gap-x-3 { column-gap: 12px; } .gap-x-4 { column-gap: 16px; }
  .gap-x-6 { column-gap: 24px; } .gap-x-8 { column-gap: 32px; } .gap-x-10 { column-gap: 40px; }
  .gap-x-12 { column-gap: 48px; } .gap-x-16 { column-gap: 64px; }
  .gap-y-1 { row-gap: 4px; } .gap-y-1\.5 { row-gap: 6px; } .gap-y-2 { row-gap: 8px; }
  .gap-y-3 { row-gap: 12px; } .gap-y-4 { row-gap: 16px; } .gap-y-5 { row-gap: 20px; } .gap-y-6 { row-gap: 24px; }

  /* padding */
  .p-1 { padding: 4px; } .p-1\.5 { padding: 6px; } .p-2 { padding: 8px; }
  .p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-6 { padding: 24px; }
  .px-1 { padding-inline: 4px; } .px-1\.5 { padding-inline: 6px; } .px-2 { padding-inline: 8px; }
  .px-2\.5 { padding-inline: 10px; } .px-3 { padding-inline: 12px; } .px-4 { padding-inline: 16px; } .px-6 { padding-inline: 24px; }
  .py-0\.5 { padding-block: 2px; } .py-1 { padding-block: 4px; } .py-1\.5 { padding-block: 6px; }
  .py-2 { padding-block: 8px; } .py-3 { padding-block: 12px; } .py-4 { padding-block: 16px; }
  .py-8 { padding-block: 32px; } .py-12 { padding-block: 48px; } .py-16 { padding-block: 64px; } .py-20 { padding-block: 80px; }
  .pb-2 { padding-bottom: 8px; } .pb-3 { padding-bottom: 12px; } .pb-4 { padding-bottom: 16px; }
  .pt-3 { padding-top: 12px; } .pr-1 { padding-right: 4px; }

  /* margin */
  .mx-auto { margin-inline: auto; } .ml-auto { margin-left: auto; } .my-auto { margin-block: auto; }
  .mt-0\.5 { margin-top: 2px; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
  .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
  .mb-0\.5 { margin-bottom: 2px; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
  .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
  .mr-2 { margin-right: 8px; } .ml-1 { margin-left: 4px; }

  /* space-between children */
  .space-y-0\.5 > * + * { margin-top: 2px; }
  .space-y-1 > * + * { margin-top: 4px; }
  .space-y-2 > * + * { margin-top: 8px; }
  .space-y-3 > * + * { margin-top: 12px; }
  .space-y-4 > * + * { margin-top: 16px; }
  .space-y-6 > * + * { margin-top: 24px; }

  /* sizing */
  .w-full { width: 100%; } .h-full { height: 100%; }
  .w-2 { width: 8px; } .w-4 { width: 16px; } .w-5 { width: 20px; } .w-8 { width: 32px; }
  .w-12 { width: 48px; } .w-14 { width: 56px; } .w-16 { width: 64px; } .w-20 { width: 80px; }
  .w-24 { width: 96px; } .w-28 { width: 112px; } .w-32 { width: 128px; } .w-36 { width: 144px; } .w-40 { width: 160px; }
  .h-2 { height: 8px; } .h-4 { height: 16px; } .h-5 { height: 20px; } .h-8 { height: 32px; }
  .h-12 { height: 48px; } .h-80 { height: 320px; }
  .min-h-screen { min-height: 100vh; }
  .max-w-md { max-width: 28rem; } .max-w-2xl { max-width: 42rem; } .max-w-3xl { max-width: 48rem; }
  .max-w-4xl { max-width: 56rem; } .max-w-5xl { max-width: 64rem; } .max-w-6xl { max-width: 72rem; } .max-w-7xl { max-width: 80rem; }
  .max-h-32 { max-height: 128px; } .max-h-48 { max-height: 192px; } .max-h-64 { max-height: 256px; } .max-h-72 { max-height: 288px; }

  /* overflow */
  .overflow-auto { overflow: auto; } .overflow-hidden { overflow: hidden; } .overflow-x-auto { overflow-x: auto; }

  /* position */
  .relative { position: relative; } .absolute { position: absolute; } .fixed { position: fixed; } .sticky { position: sticky; }
  .inset-0 { inset: 0; } .inset-y-0 { top: 0; bottom: 0; } .right-0 { right: 0; } .top-0 { top: 0; }
  .z-50 { z-index: 50; }

  /* typography */
  .text-\[10px\] { font-size: 10px; }
  .text-xs { font-size: 12px; line-height: 1.4; }
  .text-sm { font-size: 14px; line-height: 1.45; }
  .text-base { font-size: 16px; } .text-lg { font-size: 18px; line-height: 1.4; }
  .text-xl { font-size: 20px; line-height: 1.3; } .text-2xl { font-size: 24px; line-height: 1.25; }
  .text-3xl { font-size: 30px; line-height: 1.2; } .text-4xl { font-size: 36px; line-height: 1.15; }
  .font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
  .tracking-tight { letter-spacing: var(--track-tight); } .tracking-wide { letter-spacing: .04em; }
  .leading-tight { line-height: 1.2; }
  .uppercase { text-transform: uppercase; }
  .text-center { text-align: center; } .text-left { text-align: left; } .text-right { text-align: right; }
  .underline { text-decoration: underline; }
  .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .whitespace-nowrap { white-space: nowrap; }

  /* radius */
  .rounded { border-radius: var(--radius-sm); } .rounded-lg { border-radius: var(--radius); }
  .rounded-xl { border-radius: var(--radius-lg); } .rounded-full { border-radius: var(--radius-pill); }

  /* border */
  .border { border: 1px solid var(--line); } .border-t { border-top: 1px solid var(--line); }
  .border-b { border-bottom: 1px solid var(--line); } .border-y { border-block: 1px solid var(--line); }
  .border-b-2 { border-bottom: 2px solid var(--line); } .border-t-2 { border-top: 2px solid var(--line); }
  .border-slate-100, .border-slate-200 { border-color: var(--line); }
  .border-slate-300 { border-color: var(--line-2); }
  .border-sky-200, .border-sky-300 { border-color: var(--accent-soft); }
  .border-emerald-200 { border-color: #bbf7d0; }
  .border-amber-200 { border-color: #fde68a; }
  .border-red-200 { border-color: #fecaca; }

  /* text colours -> CivilKit tokens */
  .text-white { color: #fff; }
  .text-slate-300 { color: var(--txt-3); } .text-slate-400 { color: var(--txt-3); }
  .text-slate-500 { color: var(--txt-2); } .text-slate-600 { color: var(--txt-1); }
  .text-slate-700 { color: var(--txt-1); } .text-slate-800 { color: var(--txt-0); } .text-slate-900 { color: var(--txt-0); }
  .text-sky-100 { color: var(--accent-soft); } .text-sky-600 { color: var(--accent-cta); } .text-sky-700 { color: var(--accent-cta-2); }
  .text-emerald-600 { color: var(--ok); } .text-emerald-700 { color: var(--ok-ink); }
  .text-amber-600 { color: var(--warn); } .text-amber-700 { color: var(--warn-ink); } .text-amber-800 { color: #92400e; }
  .text-red-300 { color: #fca5a5; } .text-red-500 { color: #ef4444; } .text-red-600 { color: var(--danger); } .text-red-700 { color: var(--danger-ink); }

  /* background colours -> CivilKit tokens */
  .bg-white { background: var(--bg-1); }
  .bg-slate-50 { background: var(--bg-0); } .bg-slate-100 { background: var(--bg-2); } .bg-slate-900 { background: var(--ink-deep); }
  .bg-sky-50 { background: var(--accent-soft-2); } .bg-sky-100 { background: var(--accent-soft); } .bg-sky-600 { background: var(--accent-cta); }
  .bg-emerald-50 { background: #ecfdf5; } .bg-emerald-100 { background: var(--ok-soft); }
  .bg-amber-50 { background: var(--warn-soft); } .bg-red-50 { background: var(--danger-soft); }

  /* effects */
  .shadow-lg { box-shadow: var(--shadow-lg); } .shadow-xl { box-shadow: var(--shadow-lg); }
  .opacity-50 { opacity: .5; } .opacity-60 { opacity: .6; }
  .transition-colors { transition: color .12s, background-color .12s, border-color .12s; }
  .transition-shadow { transition: box-shadow .3s; } .duration-500 { transition-duration: .5s; }
  .cursor-pointer { cursor: pointer; } .select-none { user-select: none; }
  .ring-2 { box-shadow: 0 0 0 2px var(--accent-soft); }

  /* hover states */
  .hover\:bg-sky-700:hover { background: var(--accent-cta-2); }
  .hover\:bg-emerald-700:hover { background: var(--ok-ink); }
  .hover\:bg-slate-100:hover { background: var(--bg-2); }
  .hover\:bg-sky-100:hover { background: var(--accent-soft); }
  .hover\:bg-sky-200:hover { background: #bfdbfe; }
  .hover\:bg-emerald-100:hover { background: var(--ok-soft); }
  .hover\:border-sky-400:hover { border-color: var(--accent); }
  .hover\:border-sky-500:hover { border-color: var(--accent-cta); }
  .hover\:border-emerald-400:hover { border-color: #4ade80; }
  .hover\:border-red-400:hover { border-color: #f87171; }
  .hover\:border-slate-400:hover { border-color: var(--ink-400); }
  .hover\:text-sky-600:hover { color: var(--accent-cta); }
  .hover\:text-sky-700:hover { color: var(--accent-cta-2); }
  .hover\:text-red-600:hover { color: var(--danger); }
  .hover\:text-red-700:hover { color: var(--danger-ink); }
  .hover\:text-slate-700:hover { color: var(--txt-1); }
  .hover\:text-white:hover { color: #fff; }

  /* disabled states */
  .disabled\:opacity-30:disabled { opacity: .3; }
  .disabled\:opacity-40:disabled { opacity: .4; }
  .disabled\:opacity-50:disabled { opacity: .5; }
  .disabled\:bg-slate-50:disabled { background: var(--bg-0); }
  .disabled\:bg-slate-100:disabled { background: var(--bg-2); }
  .disabled\:text-slate-400:disabled { color: var(--txt-3); }
  .disabled\:text-slate-500:disabled { color: var(--txt-2); }

  /* responsive: md (>=768) */
  @media (min-width: 768px) {
    .md\:flex { display: flex; } .md\:flex-row { flex-direction: row; }
    .md\:items-center { align-items: center; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
    .md\:grid-cols-5 { grid-template-columns: repeat(5,minmax(0,1fr)); }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
    .md\:p-6 { padding: 24px; } .md\:px-6 { padding-inline: 24px; }
    .md\:text-5xl { font-size: 48px; line-height: 1.1; }
  }
  /* responsive: lg (>=1024) */
  @media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
    .lg\:grid-cols-5 { grid-template-columns: repeat(5,minmax(0,1fr)); }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
    .lg\:sticky { position: sticky; } .lg\:top-6 { top: 24px; }
  }
  /* responsive: sm (>=640) */
  @media (min-width: 640px) {
    .sm\:flex-row { flex-direction: row; }
    .sm\:items-center { align-items: center; }
  }

  .ck-focus:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

  /* ---- estimator (index.html) coverage: extra utilities it relies on ---- */
  .ml-2 { margin-left: 8px; }
  .border-2 { border-width: 2px; } .border-dashed { border-style: dashed; }
  .bg-amber-600 { background: var(--warn); } .bg-emerald-600 { background: var(--ok); }
  .bg-black\/30 { background: rgba(0,0,0,.3); } .bg-black\/50 { background: rgba(0,0,0,.5); }
  .bg-slate-50\/50 { background: rgba(248,250,252,.6); }
  .bg-slate-900\/90 { background: rgba(15,23,42,.9); }
  .border-red-400 { border-color: #f87171; }
  .border-sky-600 { border-color: var(--accent-cta); }
  .max-w-lg { max-width: 32rem; }
  .max-w-\[10rem\] { max-width: 10rem; } .max-w-\[16rem\] { max-width: 16rem; }
  .max-h-\[90vh\] { max-height: 90vh; }
  .min-w-\[6rem\] { min-width: 6rem; } .min-w-\[8rem\] { min-width: 8rem; }
  .min-w-\[10rem\] { min-width: 10rem; } .min-w-\[900px\] { min-width: 900px; }
  .rounded-tl-lg { border-top-left-radius: var(--radius); } .rounded-tr-lg { border-top-right-radius: var(--radius); }
  .rounded-bl-lg { border-bottom-left-radius: var(--radius); } .rounded-br-lg { border-bottom-right-radius: var(--radius); }
  .rounded-b-lg { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
  /* highlight ring (quote flash) */
  .ring-sky-300 { box-shadow: 0 0 0 2px var(--accent); }
  /* extra hover/focus/disabled variants */
  .hover\:bg-amber-700:hover { background: var(--warn-ink); }
  .hover\:text-amber-700:hover { color: var(--warn-ink); }
  .hover\:text-emerald-800:hover { color: #065f46; }
  .focus\:ring-sky-500:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.3); }
  .disabled\:bg-slate-300:disabled { background: var(--bg-4); }
  .disabled\:border-slate-200:disabled { border-color: var(--line); }
  .disabled\:text-slate-300:disabled { color: var(--txt-3); }
  @media (min-width: 768px) { .md\:w-2\/3 { width: 66.6667%; } }
  @media (min-width: 1024px) { .lg\:w-1\/2 { width: 50%; } }
}
