@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* --- Reset & Core --- */
*, ::before, ::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: #DEDFDA;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0;
  background-color: #F4F5F1;
  color: #14171A;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: 'Fraunces', ui-serif, Georgia, serif;
}

.font-sans {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

.font-mono {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}

/* --- Layout & Flexbox & Grid --- */
.h-full { height: 100%; }
.min-h-full { min-height: 100%; }
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-9 { width: 2.25rem; }
.h-9 { height: 2.25rem; }
.w-2\.5 { width: 0.625rem; }
.h-2\.5 { height: 0.625rem; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.grid { display: grid; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }
.gap-12 { gap: 3rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }

/* --- Spacing --- */
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-2 { margin-left: 0.5rem; }
.mt-4 { margin-top: 1rem; }

.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-12 { padding-top: 3rem; }
.pb-20 { padding-bottom: 5rem; }
.pb-24 { padding-bottom: 6rem; }

.max-w-6xl { max-width: 72rem; }
.max-w-md { max-width: 28rem; }
.max-w-sm { max-width: 24rem; }
.aspect-square { aspect-ratio: 1 / 1; }

/* --- Colors & Backgrounds --- */
.bg-paper { background-color: #F4F5F1; }
.bg-white { background-color: #FFFFFF; }
.bg-ink { background-color: #14171A; }
.bg-ledger { background-color: #1B6F5C; }
.bg-ledger-50 { background-color: #E6F0EE; }
.bg-ledger-600 { background-color: #155B4C; }
.bg-stamp { background-color: #C97A2B; }
.bg-stamp-50 { background-color: #FBF0E4; }
.bg-danger { background-color: #B3402A; }
.bg-danger\/10 { background-color: rgba(179, 64, 42, 0.1); }
.bg-danger\/70 { background-color: rgba(179, 64, 42, 0.7); }
.bg-stamp\/70 { background-color: rgba(201, 122, 43, 0.7); }
.bg-ledger\/70 { background-color: rgba(27, 111, 92, 0.7); }

.text-ink { color: #14171A; }
.text-ink-60 { color: #4B5157; }
.text-ink-30 { color: #A7ACB1; }
.text-paper { color: #F4F5F1; }
.text-white { color: #FFFFFF; }
.text-ledger { color: #1B6F5C; }
.text-ledger-700 { color: #0F4A3E; }
.text-stamp { color: #C97A2B; }
.text-danger { color: #B3402A; }

.border { border-style: solid; border-width: 1px; }
.border-line { border-color: #DEDFDA; }
.border-ledger { border-color: #1B6F5C; }

/* --- Typography Sizing & Weight --- */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.leading-\[1\.1\] { line-height: 1.1; }

/* --- 100% Rounded & Pill Corners --- */
.rounded-full, .rounded-pill, [class*="rounded-full"] { border-radius: 9999px !important; }
.rounded-md, .rounded-lg, .rounded-xl, .rounded-xl2, .rounded-2xl, .rounded-3xl { border-radius: 1.75rem !important; }

/* Links & Pill Buttons */
a {
  color: inherit;
  text-decoration: inherit;
}
a.text-ink-60:hover { color: #14171A; }

.btn, button, input[type="submit"], input[type="button"], a.btn-accent, a.btn-primary, a.btn-ghost, a.btn-danger {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  border-radius: 9999px !important; /* Full Pill Shape */
  padding: 0.625rem 1.5rem !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease-in-out !important;
  border: 1px solid transparent !important;
}

.btn-primary { background-color: #14171A !important; color: #F4F5F1 !important; }
.btn-primary:hover { background-color: rgba(20,23,26,0.85) !important; transform: translateY(-1px); }

.btn-accent { background-color: #1B6F5C !important; color: #FFFFFF !important; box-shadow: 0 4px 14px rgba(27, 111, 92, 0.25) !important; }
.btn-accent:hover { background-color: #155B4C !important; transform: translateY(-1px); }

.btn-ghost { background-color: transparent !important; color: #14171A !important; border-color: #DEDFDA !important; }
.btn-ghost:hover { background-color: rgba(20,23,26,0.05) !important; }

.btn-danger { background-color: #B3402A !important; color: #FFFFFF !important; }

/* Soft Rounded Cards & Modals */
.card, div.card, div[class*="card"] {
  background-color: #FFFFFF !important;
  border: 1px solid #DEDFDA !important;
  border-radius: 1.75rem !important; /* Smooth Rounded Corners */
  box-shadow: 0 4px 20px rgba(20,23,26,0.06), 0 1px 6px rgba(20,23,26,0.04) !important;
  overflow: hidden;
}

/* Pill & Curved Inputs */
.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
  width: 100% !important;
  border-radius: 9999px !important; /* Pill Inputs */
  border: 1px solid #DEDFDA !important;
  background-color: #FFFFFF !important;
  padding: 0.625rem 1.25rem !important;
  font-size: 0.875rem !important;
  outline: none !important;
  transition: all 0.2s ease-in-out !important;
}

textarea, textarea.input {
  width: 100% !important;
  border-radius: 1.5rem !important; /* Curved Textarea */
  border: 1px solid #DEDFDA !important;
  background-color: #FFFFFF !important;
  padding: 0.75rem 1.25rem !important;
  font-size: 0.875rem !important;
  outline: none !important;
}

.input:focus, input:focus, select:focus, textarea:focus {
  border-color: #1B6F5C !important;
  box-shadow: 0 0 0 3px rgba(27, 111, 92, 0.15) !important;
}

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4B5157;
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge {
  display: inline-flex !important;
  align-items: center !important;
  border-radius: 9999px !important; /* Pill Badges */
  padding: 0.25rem 0.75rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
}
.badge-draft { background-color: rgba(20, 23, 26, 0.08) !important; color: #4B5157 !important; }
.badge-published { background-color: #E6F0EE !important; color: #0F4A3E !important; }
.badge-closed { background-color: #FBF0E4 !important; color: #C97A2B !important; }

/* Curved Options & Scale Indicators */
.aspect-square {
  border-radius: 9999px !important; /* Full Pill/Circle Numbers */
  transition: all 0.2s ease !important;
}

.swoosh-progress {
  position: relative;
  height: 6px;
  background-color: #DEDFDA;
  border-radius: 9999px !important;
  overflow: hidden;
}
.swoosh-progress > span {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  background-color: #1B6F5C;
  border-radius: 9999px !important;
  transition: width 0.4s ease;
}

/* --- Media Queries --- */
/* --- Global SVG Sizing Safeguards --- */
svg {
  max-width: 100%;
  box-sizing: border-box;
}

svg.w-5, aside svg, nav svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  max-width: 1.25rem !important;
  max-height: 1.25rem !important;
  min-width: 1.25rem !important;
  min-height: 1.25rem !important;
  flex-shrink: 0 !important;
}

svg.w-4 {
  width: 1rem !important;
  height: 1rem !important;
  max-width: 1rem !important;
  max-height: 1rem !important;
  min-width: 1rem !important;
  min-height: 1rem !important;
  flex-shrink: 0 !important;
}

/* --- Multi-Column Grid Rules (Auto-Fit Rows) --- */
.metrics-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 1.25rem !important;
}

.forms-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 1.5rem !important;
}

.templates-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 1.25rem !important;
}

@media (min-width: 640px) {
  .sm\:px-10 { padding-left: 2.5rem; padding-right: 2.5rem; }
  .sm\:text-5xl { font-size: 3rem; line-height: 1; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

/* --- Refined Builder Workspace & Sidebars --- */
.builder-workspace-grid {
  display: grid !important;
  grid-template-columns: 280px 1fr 320px !important;
  gap: 1.5rem !important;
  width: 100% !important;
}

@media (max-width: 1100px) {
  .builder-workspace-grid {
    grid-template-columns: 240px 1fr 280px !important;
  }
}

@media (max-width: 900px) {
  .builder-workspace-grid {
    grid-template-columns: 1fr !important;
  }
}

.builder-elements-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.5rem !important;
  width: 100% !important;
}

.builder-canvas-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 1rem !important;
  width: 100% !important;
}

@media (max-width: 640px) {
  .builder-canvas-grid {
    grid-template-columns: 1fr !important;
  }
}

.builder-canvas-grid > div.full-width,
.builder-canvas-grid > template + div.full-width {
  grid-column: span 2 / span 2 !important;
  width: 100% !important;
}

.builder-canvas-grid > div {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* --- Clean Element Tile Pill Buttons --- */
.element-tile-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.5rem !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 0.875rem !important;
  border: 1px solid #DEDFDA !important;
  background-color: #FFFFFF !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: #14171A !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  user-select: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important;
}

.element-tile-btn:hover {
  background-color: #E6F0EE !important;
  border-color: #1B6F5C !important;
  color: #0F4A3E !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(27,111,92,0.1) !important;
}






