:root {
  --sdf-blue: #5c99ee;
  --sdf-blue-dark: #344761;
  --sdf-ink: #344761;
  --sdf-muted: #535d6b;
  --sdf-line: #e4edf8;
  --sdf-bg: #f8fbff;
  --sdf-soft: #eef6ff;
  --sdf-green: #24a172;
  --sdf-amber: #f59e0b;
  --sdf-danger: #b42318;
  --sdf-radius: 8px;
  --sdf-heading: "Questrial", system-ui, sans-serif;
  --sdf-body: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sdf-nav: "Open Sans", system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body {
  color: var(--sdf-muted);
  background: #fff;
  font-family: var(--sdf-body);
  line-height: 1.62;
}
a { color: var(--sdf-blue); text-decoration: none; transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease; }
a:hover { color: var(--sdf-blue-dark); }
h1, h2, h3, h4, h5, h6 {
  color: var(--sdf-ink);
  font-family: var(--sdf-heading);
  letter-spacing: 0;
}
.navbar {
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid rgba(228, 237, 248, .84);
  box-shadow: 0 10px 30px rgba(52, 71, 97, .05);
  backdrop-filter: blur(14px);
  padding: 14px 0;
}
.navbar-brand {
  color: var(--sdf-ink);
  font-family: var(--sdf-heading);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border-radius: 8px;
  object-fit: contain;
}
.nav-link {
  color: rgba(83, 93, 107, .92);
  font-family: var(--sdf-nav);
  font-size: .92rem;
  font-weight: 600;
}
.nav-link:hover { color: var(--sdf-ink); }
.btn {
  border-radius: 999px;
  font-family: var(--sdf-nav);
  font-weight: 700;
  padding: .72rem 1.15rem;
}
.btn-sm { padding: .42rem .82rem; }
.btn-lg { padding: .9rem 1.4rem; }
.btn-primary {
  --bs-btn-bg: var(--sdf-blue);
  --bs-btn-border-color: var(--sdf-blue);
  --bs-btn-hover-bg: var(--sdf-blue-dark);
  --bs-btn-hover-border-color: var(--sdf-blue-dark);
}
.btn-outline-primary {
  --bs-btn-color: var(--sdf-blue-dark);
  --bs-btn-border-color: rgba(92, 153, 238, .38);
  --bs-btn-hover-bg: var(--sdf-blue);
  --bs-btn-hover-border-color: var(--sdf-blue);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sdf-blue-dark);
  background: rgba(92, 153, 238, .12);
  border: 1px solid rgba(92, 153, 238, .18);
  border-radius: 999px;
  padding: 8px 13px;
  font-family: var(--sdf-nav);
  font-size: .82rem;
  font-weight: 700;
}
.hero {
  position: relative;
  overflow: hidden;
  min-height: 720px;
  padding: 112px 0 80px;
  background:
    radial-gradient(circle at 82% 20%, rgba(92, 153, 238, .18), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--sdf-bg) 100%);
}
.hero .container { position: relative; z-index: 1; }
.hero h1 {
  max-width: 760px;
  font-size: 5.1rem;
  line-height: 1.02;
  font-weight: 400;
}
.hero p {
  max-width: 660px;
  color: var(--sdf-muted);
  font-size: 1.16rem;
}
.hero-visual {
  position: relative;
  min-height: 520px;
}
.workflow-window {
  position: relative;
  background: #fff;
  border: 1px solid var(--sdf-line);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(52, 71, 97, .16);
  padding: 18px;
}
.window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sdf-line);
}
.window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dce7f5;
}
.document-preview {
  margin-top: 18px;
  background: linear-gradient(180deg, #fbfdff, #f4f8fd);
  border: 1px solid var(--sdf-line);
  border-radius: 12px;
  padding: 18px;
}
.doc-line { height: 10px; border-radius: 999px; background: #dce8f6; margin-bottom: 12px; }
.doc-line.short { width: 62%; }
.signature-stamp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--sdf-blue-dark);
  background: #fff;
  border: 1px solid rgba(92,153,238,.28);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 12px 28px rgba(92,153,238,.12);
}
.floating-card {
  position: absolute;
  right: -10px;
  bottom: 34px;
  max-width: 260px;
  background: #fff;
  border: 1px solid var(--sdf-line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 22px 50px rgba(52, 71, 97, .14);
}
.section { padding: 84px 0; }
.light-section { background: var(--sdf-bg); }
.section-title {
  max-width: 760px;
  margin: 0 auto 42px;
  text-align: center;
}
.section-title h2 {
  font-size: 2.8rem;
  line-height: 1.12;
}
.section-title p { margin: 12px auto 0; max-width: 650px; }
.surface, .service-card, .pricing-card, .tool-card {
  background: #fff;
  border: 1px solid var(--sdf-line);
  border-radius: var(--sdf-radius);
  box-shadow: 0 12px 36px rgba(52, 71, 97, .06);
}
.service-card, .pricing-card, .tool-card {
  height: 100%;
  padding: 28px;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.service-card:hover, .pricing-card:hover, .tool-card:hover {
  transform: translateY(-5px);
  border-color: rgba(92,153,238,.34);
  box-shadow: 0 18px 45px rgba(52, 71, 97, .11);
}
.icon-box {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  color: var(--sdf-blue);
  background: rgba(92,153,238,.12);
  border-radius: 8px;
  font-size: 1.35rem;
}
.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.feature-list li {
  display: flex;
  gap: 10px;
  margin: 11px 0;
}
.feature-list i { color: var(--sdf-green); }
.metric {
  background: #fff;
  border: 1px solid var(--sdf-line);
  border-radius: var(--sdf-radius);
  padding: 18px;
  min-height: 112px;
}
.metric strong { display:block; font-size:1.7rem; color: var(--sdf-ink); }
.sidebar {
  background: #fff;
  border-right: 1px solid var(--sdf-line);
  min-height: calc(100vh - 64px);
}
.sidebar a {
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius: var(--sdf-radius);
  color: var(--sdf-ink);
  text-decoration:none;
}
.sidebar a.active, .sidebar a:hover { background: var(--sdf-soft); color: var(--sdf-blue-dark); }
.tool-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:18px; }
.pdf-tools-toolbar {
  display: grid;
  gap: 4px;
}
.pdf-tool-grid {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}
.pdf-tool-card {
  display: flex;
  flex-direction: column;
}
.pdf-tool-card p {
  min-height: 54px;
}
.pdf-tool-card .btn {
  margin-top: auto;
}
.pdf-tool-facts {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 6px 10px;
  margin-bottom: 18px;
  font-size: .9rem;
}
.pdf-tool-facts dt {
  color: var(--sdf-ink);
  font-weight: 700;
}
.pdf-tool-facts dd {
  margin: 0;
}
.pdf-tool-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}
.pdf-tool-side {
  position: sticky;
  top: 96px;
}
.pdf-drop-zone {
  border: 1px dashed rgba(92, 153, 238, .45);
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
}
.pdf-check {
  min-height: 44px;
  padding: 11px 12px 11px 38px;
  border: 1px solid var(--sdf-line);
  border-radius: 8px;
  background: #fff;
}
.pdf-progress {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--sdf-muted);
  font-size: .92rem;
}
.pdf-progress.is-processing {
  color: #7c4a03;
  font-weight: 600;
}
.pdf-job-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pdf-job-progress span {
  padding: 10px;
  text-align: center;
  border: 1px solid var(--sdf-line);
  border-radius: 8px;
  color: var(--sdf-muted);
  background: #fff;
  font-weight: 700;
}
.pdf-job-progress span.active {
  color: var(--sdf-blue-dark);
  background: var(--sdf-soft);
  border-color: rgba(92,153,238,.34);
}
.pdf-page {
  position: relative;
  aspect-ratio: 8.5 / 11;
  background: #fff;
  border: 1px solid var(--sdf-line);
  border-radius: 4px;
  overflow: hidden;
}
.pdf-page-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: #fff;
  pointer-events: none;
  user-select: none;
}
.pdf-page-help {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  color: var(--sdf-muted);
  background: rgba(255,255,255,.92);
  border: 1px solid var(--sdf-line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .84rem;
  text-align: center;
  pointer-events: none;
}
.field-box {
  position: absolute;
  z-index: 3;
  min-width: 70px;
  min-height: 28px;
  border: 2px solid var(--sdf-blue);
  background: rgba(92,153,238,.09);
  border-radius: 4px;
  padding: 4px;
  cursor: move;
  font-size: 12px;
  touch-action: none;
  user-select: none;
}
.field-box-label {
  display: block;
  overflow: hidden;
  padding-right: 16px;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.15;
}
.field-box-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  color: #fff;
  background: var(--sdf-danger);
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(52, 71, 97, .18);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.signature-pad {
  width: 100%;
  height: 180px;
  border: 1px solid var(--sdf-line);
  border-radius: var(--sdf-radius);
  background: #fff;
  touch-action: none;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}
.status-ok { background: #12b76a; }
.status-warn { background: #f79009; }
.status-bad { background: var(--sdf-danger); }
.form-control, .form-select {
  border-color: var(--sdf-line);
  border-radius: 8px;
  padding: .78rem .9rem;
}
.form-control:focus, .form-select:focus, .btn:focus-visible {
  box-shadow: 0 0 0 .25rem rgba(92,153,238,.18);
  border-color: var(--sdf-blue);
}

.error-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 16%, rgba(92, 153, 238, .18), transparent 32%),
    linear-gradient(135deg, #f8fbff 0%, #eef5ff 48%, #ffffff 100%);
  color: var(--sdf-ink);
}
.error-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 26px;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}
.error-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--sdf-ink);
  font-family: var(--sdf-heading);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}
.error-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(191, 211, 238, .72);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 24px 70px rgba(30, 64, 175, .13);
  padding: clamp(30px, 6vw, 64px);
}
.error-code {
  color: rgba(92, 153, 238, .18);
  font-family: var(--sdf-heading);
  font-size: clamp(5rem, 16vw, 11rem);
  font-weight: 700;
  line-height: .82;
  margin-bottom: 10px;
}
.error-panel h1 {
  max-width: 680px;
  margin: 12px 0;
  font-family: var(--sdf-heading);
  font-size: clamp(2.2rem, 6vw, 4.3rem);
  line-height: 1;
}
.error-panel p {
  max-width: 600px;
  color: var(--sdf-muted);
  font-size: 1.08rem;
}
.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.error-footnote {
  max-width: 680px;
  margin: 0;
  color: var(--sdf-muted);
  font-size: .94rem;
}
.contact-panel {
  background: var(--sdf-blue-dark);
  color: #eaf2ff;
  border-radius: 12px;
  padding: 34px;
  min-height: 100%;
}
.contact-panel h3 { color: #fff; }
.contact-method {
  display: flex;
  gap: 14px;
  margin-top: 22px;
}
.contact-method i {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: rgba(255,255,255,.14);
  border-radius: 8px;
}
footer {
  background: var(--sdf-bg);
  color: var(--sdf-muted);
  border-top: 1px solid var(--sdf-line);
}
footer strong, footer h4 { color: var(--sdf-ink); }
footer a { color: var(--sdf-muted); text-decoration: none; }
footer a:hover { color: var(--sdf-blue); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
}
@media (max-width: 991px) {
  .hero { min-height: auto; padding: 76px 0 56px; }
  .hero h1 { font-size: 3.8rem; }
  .section-title h2 { font-size: 2.35rem; }
  .hero-visual { min-height: auto; margin-top: 34px; }
  .floating-card { position: static; margin: 16px 0 0 auto; }
}
@media (max-width: 767px) {
  .section { padding: 52px 0; }
  .sidebar { min-height: auto; border-right: 0; border-bottom: 1px solid var(--sdf-line); }
  .navbar { padding: 10px 0; }
  .hero h1 { font-size: 2.45rem; }
  .service-card, .pricing-card, .tool-card { padding: 22px; }
  .pdf-tool-layout { grid-template-columns: 1fr; }
  .pdf-tool-side { position: static; }
}

/* Authenticated app shell */
.admin-body {
  --admin-bg: #f7f9fc;
  --admin-surface: #ffffff;
  --admin-text: #334155;
  --admin-heading: #0f172a;
  --admin-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-border-light: #f1f5f9;
  --admin-accent: #0971d2;
  --admin-accent-soft: rgba(59, 130, 246, .12);
  --admin-sidebar-width: 252px;
  --admin-header-height: 64px;
  color: var(--admin-text);
  background: var(--admin-bg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
}
.admin-body h1,
.admin-body h2,
.admin-body h3,
.admin-body h4,
.admin-body h5,
.admin-body h6 {
  color: var(--admin-heading);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
}
.admin-body .btn {
  border-radius: 3px;
  font-size: .92rem;
  padding: .58rem .9rem;
}
.admin-body .surface,
.admin-body .metric {
  border-color: var(--admin-border);
  border-radius: 3px;
  box-shadow: 0 2px 8px -3px rgb(15 23 42 / 8%), 0 1px 3px 0 rgb(15 23 42 / 4%);
}
.admin-body .table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: #f8fafc;
  color: var(--admin-text);
  font-size: .92rem;
}
.admin-body .table thead th {
  color: var(--admin-muted);
  background: #f1f5f9;
  border-bottom: 1px solid var(--admin-border);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.admin-body .form-control,
.admin-body .form-select {
  border-radius: 3px;
  font-size: .92rem;
  padding: .62rem .75rem;
}
.admin-shell {
  min-height: 100vh;
  padding-top: var(--admin-header-height);
  padding-left: var(--admin-sidebar-width);
}
.admin-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--admin-header-height);
  padding: 0 18px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 0 1px 0 rgb(15 23 42 / 6%);
  backdrop-filter: blur(14px);
}
.admin-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(var(--admin-sidebar-width) - 18px);
  color: var(--admin-heading);
  font-size: 1.05rem;
  font-weight: 700;
}
.admin-logo:hover { color: var(--admin-heading); }
.admin-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 3px;
  object-fit: contain;
}
.admin-search {
  flex: 1;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  height: 40px;
  padding: 0 12px;
  color: var(--admin-muted);
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 3px;
}
.admin-search:focus-within {
  border-color: rgba(37, 99, 235, .45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.admin-search input {
  flex: 1;
  min-width: 0;
  color: var(--admin-text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: .92rem;
}
.admin-search input::placeholder {
  color: var(--admin-muted);
  opacity: 1;
}
.admin-search kbd {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--admin-muted);
  background: #f1f5f9;
  border: 1px solid var(--admin-border);
  border-radius: 3px;
  box-shadow: none;
  font-family: "JetBrains Mono", monospace;
}
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.admin-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--admin-text);
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 3px;
}
.admin-icon-btn:hover {
  color: var(--admin-accent);
  background: #f8fafc;
}
.admin-user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 10px 0 6px;
  color: var(--admin-heading);
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 3px;
  cursor: pointer;
}
.admin-user-chip:hover,
.admin-user-chip:focus {
  color: var(--admin-accent);
  background: #f8fafc;
}
.admin-user-chip.dropdown-toggle::after { display: none; }
.admin-user-chip span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #fff;
  background: #1e40af;
  border-radius: 3px;
  font-size: .78rem;
  font-weight: 700;
}
.admin-user-chip strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .86rem;
}
.admin-search-result-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--admin-accent);
  background: #eff6ff;
  border-radius: 3px;
}
.document-open-preview {
  display: flex;
  justify-content: center;
  min-height: 520px;
  max-height: 78vh;
  overflow: auto;
  background: #e5e7eb;
  border: 1px solid var(--admin-border);
  border-radius: 3px;
  padding: 18px;
}
.document-open-preview img {
  display: block;
  width: min(100%, 860px);
  height: auto;
  align-self: flex-start;
  background: #fff;
  box-shadow: 0 14px 36px rgb(15 23 42 / 18%);
}
.admin-sidebar {
  position: fixed;
  top: var(--admin-header-height);
  bottom: 0;
  left: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  width: var(--admin-sidebar-width);
  padding: 18px 12px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid #e9eef5;
}
.sidebar-section-label {
  padding: 0 10px 10px;
  color: var(--admin-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.admin-sidebar a,
.admin-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--admin-text);
  background: transparent;
  border: 0;
  border-radius: 3px;
  font: inherit;
  font-weight: 600;
  text-align: left;
}
.admin-sidebar a i,
.admin-logout i {
  width: 20px;
  color: var(--admin-muted);
  font-size: 1.05rem;
}
.admin-sidebar a:hover,
.admin-logout:hover {
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
}
.admin-sidebar a.active {
  color: #1e40af;
  background: rgba(59, 130, 246, .16);
}
.admin-sidebar a.active i { color: #1e40af; }
.sidebar-spacer { flex: 1; min-height: 18px; }
.admin-main {
  padding: 24px;
}
.admin-main > h1:first-child,
.admin-main > .d-flex:first-child h1 {
  margin-bottom: 16px;
  font-size: 1.55rem;
}
.admin-alert {
  border: 1px solid #bae6fd;
  border-radius: 3px;
}
.admin-body .badge {
  border-radius: 3px;
  font-weight: 700;
}
@media (max-width: 991px) {
  .admin-shell { padding-left: 0; }
  .admin-logo { width: auto; }
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 10px 24px -12px rgb(15 23 42 / 18%);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { padding: 18px; }
}
@media (max-width: 575px) {
  .admin-user-chip strong { display: none; }
  .admin-header { gap: 8px; padding: 0 10px; }
  .admin-main { padding: 14px; }
}

.compact-hero { padding: 72px 0 48px; }
.search-strip {
  display: flex;
  gap: 10px;
  max-width: 720px;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .08);
}
.search-strip input { flex: 1; border: 0; outline: 0; padding: 10px 12px; }
.category-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.category-pills a,
.review-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(13, 110, 253, .16);
  background: rgba(13, 110, 253, .07);
  color: #0b5ed7;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.template-card {
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .06);
}
.template-card span {
  display: block;
  color: #64748b;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.template-card h2 { font-size: 1.08rem; margin: 0 0 8px; }
.template-card p { color: #64748b; min-height: 54px; }
.template-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.contract-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 34px;
  align-items: start;
}
.contract-main h2,
.contract-side h2 { font-size: 1.1rem; margin-top: 28px; }
.contract-side {
  position: sticky;
  top: 92px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 8px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .08);
}
.contract-preview {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  line-height: 1.62;
}
.small-preview { max-height: 520px; overflow: auto; }
.narrow-page { max-width: 760px; }
.stacked-form { display: grid; gap: 10px; }
.code-field {
  min-height: 110px;
  font-family: "JetBrains Mono", monospace;
  font-size: .88rem;
}
.code-field.tall { min-height: 280px; }
.signature-font,
.signature-preview {
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 2rem;
}
.signature-preview {
  border: 1px dashed rgba(15, 23, 42, .22);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
}
.code-panel {
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 20px;
  overflow: auto;
}
.offline-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .22);
}
@media (max-width: 991px) {
  .template-grid,
  .contract-page { grid-template-columns: 1fr; }
  .contract-side { position: static; }
}
@media (max-width: 640px) {
  .search-strip { display: grid; }
}

.contract-dashboard-head {
  align-items: flex-start;
}
.contract-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 210px) minmax(130px, 170px) minmax(130px, 170px) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.contract-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #dbe4ef;
  border-radius: 4px;
  background: #fff;
}
.contract-search-field input {
  width: 100%;
  border: 0;
  outline: 0;
}
.contract-inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
}
.contract-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.contract-quick-grid h2,
.section-title-sm {
  margin-bottom: 12px;
  font-size: 1rem;
}
.contract-mini-list {
  display: grid;
  gap: 8px;
}
.contract-mini-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  color: var(--admin-text);
  border-bottom: 1px solid #eef2f7;
  font-weight: 700;
}
.contract-mini-list span {
  color: var(--admin-muted);
  font-size: .82rem;
  font-weight: 600;
}
.contract-category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.contract-category-strip a {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: #1e40af;
  background: rgba(59, 130, 246, .1);
  border: 1px solid rgba(59, 130, 246, .18);
  border-radius: 4px;
  font-weight: 700;
}
.dashboard-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.dashboard-template-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dashboard-template-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  padding: 18px;
  border: 1px solid #e3eaf3;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}
.template-card-top,
.template-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.dashboard-template-card h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}
.dashboard-template-card h2 a {
  color: var(--admin-text);
}
.dashboard-template-card p {
  flex: 1;
  margin: 0;
  color: var(--admin-muted);
}
.template-meta-row {
  color: #64748b;
  font-size: .82rem;
  font-weight: 700;
}
.risk-badge,
.review-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.review-badge {
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}
.risk-low { color: #166534; background: #dcfce7; border: 1px solid #bbf7d0; }
.risk-medium { color: #854d0e; background: #fef9c3; border: 1px solid #fde68a; }
.risk-high { color: #9f1239; background: #ffe4e6; border: 1px solid #fecdd3; }
.risk-restricted,
.risk-blocked { color: #7c2d12; background: #ffedd5; border: 1px solid #fed7aa; }
.contract-warning-small {
  padding: 8px 10px;
  color: #7c2d12;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 4px;
  font-size: .84rem;
  font-weight: 700;
}
.dashboard-contract-layout,
.contract-wizard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.contract-detail-main h2 {
  margin-top: 24px;
  font-size: 1.08rem;
}
.contract-action-panel {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid #e3eaf3;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}
.contract-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}
.contract-facts dt {
  color: #64748b;
  font-size: .75rem;
  text-transform: uppercase;
}
.contract-facts dd {
  margin: 0;
  font-weight: 700;
}
.contract-question-list,
.contract-value-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.contract-question-list span,
.contract-value-grid div {
  padding: 10px 12px;
  border: 1px solid #e3eaf3;
  border-radius: 4px;
  background: #f8fafc;
  font-weight: 700;
}
.contract-value-grid span {
  display: block;
  color: #64748b;
  font-size: .75rem;
  text-transform: uppercase;
}
.contract-risk-box {
  padding: 14px;
  border-radius: 6px;
  border: 1px solid #e3eaf3;
  background: #f8fafc;
}
.contract-wizard-form,
.contract-live-preview {
  display: grid;
  gap: 18px;
}
.wizard-step-marker {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wizard-step-marker span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: #2563eb;
  font-weight: 800;
}
.contract-question-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.contract-question {
  display: grid;
  gap: 6px;
  font-weight: 700;
}
.contract-question small {
  color: #64748b;
  font-weight: 500;
}
.contract-clause-list {
  display: grid;
  gap: 10px;
}
.contract-clause-list .form-check {
  padding: 12px 12px 12px 38px;
  border: 1px solid #e3eaf3;
  border-radius: 4px;
}
.contract-clause-list small {
  display: block;
  color: #64748b;
}
.contract-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.contract-empty-preview {
  display: grid;
  place-items: center;
  min-height: 280px;
  color: #64748b;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
}
.contract-empty-preview i {
  font-size: 2rem;
}
@media (max-width: 1180px) {
  .contract-filter-bar,
  .dashboard-template-grid,
  .dashboard-template-grid.compact,
  .contract-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 860px) {
  .contract-filter-bar,
  .dashboard-template-grid,
  .dashboard-template-grid.compact,
  .contract-quick-grid,
  .dashboard-contract-layout,
  .contract-wizard,
  .contract-question-grid,
  .contract-question-list,
  .contract-value-grid {
    grid-template-columns: 1fr;
  }
  .contract-action-panel { position: static; }
}
