.gfb-form{margin:16px 0;padding:16px;border:1px solid var(--gfb-border-color, var(--bsd-border, #e5e5e5));border-radius:10px;max-width:none;width:100%;background:var(--gfb-form-bg, var(--bsd-surface, #fff));color:var(--gfb-text-color, var(--bsd-text, #111))}
.gfb-row{margin-bottom:12px}
.gfb-label{display:block;font-weight:600;margin-bottom:6px}
.gfb-help{font-size:12px;opacity:.8;margin-top:4px}
.gfb-error{color:var(--gfb-danger, #b00020)}
.gfb-success{padding:12px;border:1px solid var(--gfb-success-border, rgba(16,185,129,.35));background:var(--gfb-success-bg, rgba(16,185,129,.10));border-radius:8px;color:inherit}
.gfb-actions{display:flex;gap:10px;align-items:center}
.gfb-btn{padding:8px 12px;border:1px solid var(--gfb-button-bg, var(--bsd-button-bg, #1e73be));border-radius:8px;background:var(--gfb-button-bg, var(--bsd-button-bg, #1e73be));color:var(--gfb-button-text, var(--bsd-button-text, #fff));cursor:pointer;text-decoration:none;display:inline-block;line-height:1.2}
.gfb-btn-primary{background:var(--gfb-primary-strong, var(--bsd-link, #1e73be));color:var(--gfb-button-text, var(--bsd-button-text, #fff));border-color:var(--gfb-primary-strong, var(--bsd-link, #1e73be))}
.gfb-step{display:none}
.gfb-step.is-active{display:block}
.gfb-progress{display:flex;gap:6px;margin:0 0 12px 0}
.gfb-progress span{flex:1;height:6px;background:var(--gfb-progress-bg, rgba(0,0,0,.08));border-radius:99px;overflow:hidden}
.gfb-progress span.is-done{background:var(--gfb-progress-done, var(--bsd-link, #1e73be))}
.gfb-entry-table{width:100%;border-collapse:collapse}
.gfb-entry-table th,.gfb-entry-table td{border:1px solid var(--gfb-border-color, var(--bsd-border, #e5e5e5));padding:8px}
.gfb-signature{display:block;width:100%}
/* The "signature box" should be ONLY the canvas area so users can start signing anywhere inside it. */
.gfb-signature-canvas{
  display:block;
  width:100% !important;
  height:var(--gfb-signature-height,160px) !important;
  max-width:100%;
  border:1px solid var(--gfb-border-color, var(--bsd-border, #ccc));
  border-radius:8px;
  background: transparent;
  touch-action:none;
}
.gfb-signature-actions{padding:8px 0 0 0}


/* Appearance variables */
.gfb-form-wrapper{
  color: var(--gfb-text-color, var(--bsd-text, #111));
  width: 100%;
  display: block;
}
.gfb-form-wrapper .gfb-form{
  /* Default to theme variables (Build Safe dashboard theme), but allow per-form overrides */
  background: var(--gfb-form-bg, var(--bsd-surface, #fff));
  border: 1px solid var(--gfb-border-color, var(--bsd-border, #d0d0d0));
  padding: 16px;
  border-radius: 8px;
  width: var(--gfb-width, 100%);
  max-width: 100%;
  box-sizing: border-box;
}
.gfb-form-wrapper[data-align="left"] .gfb-form{ margin-left: 0 !important; margin-right: auto !important; }
.gfb-form-wrapper[data-align="center"] .gfb-form{ margin-left: auto !important; margin-right: auto !important; }
.gfb-form-wrapper[data-align="right"] .gfb-form{ margin-left: auto !important; margin-right: 0 !important; }
.gfb-form-wrapper .gfb-field{ margin-bottom: var(--gfb-gap, 12px); }

/* Full-width fields and label placement */
.gfb-form .gfb-field label{ display:block; margin: 0 0 6px 0; font-weight: 600; }
.gfb-form .gfb-field input[type="text"],
.gfb-form .gfb-field input[type="email"],
.gfb-form .gfb-field input[type="url"],
.gfb-form .gfb-field input[type="tel"],
.gfb-form .gfb-field input[type="password"],
.gfb-form .gfb-field input[type="number"],
.gfb-form .gfb-field input[type="color"],
.gfb-form .gfb-field select,
.gfb-form .gfb-field textarea{
  width: 100%;
  box-sizing: border-box;
  background: var(--gfb-field-bg, var(--bsd-surface, #fff));
  color: inherit;
  border-color: var(--gfb-border-color, var(--bsd-border, #d0d0d0));
}
.gfb-form .gfb-field-date input[type="date"],
.gfb-form .gfb-field-time input[type="time"]{
  width: auto;
  background: var(--gfb-field-bg, var(--bsd-surface, #fff));
  color: inherit;
  border-color: var(--gfb-border-color, var(--bsd-border, #d0d0d0));
}

/* Choice inputs (checkbox / radio) display horizontally */
.gfb-field-radio,
.gfb-field-checkbox{
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}
/* the field label (label[for]) should span full width */
.gfb-field-radio > label[for],
.gfb-field-checkbox > label[for]{
  flex: 0 0 100%;
  display: block;
  margin-bottom: 6px;
}
.gfb-choice{
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 14px 8px 0;
  vertical-align: top;
  white-space: nowrap;
}
.gfb-choice input{ margin: 0; }

/* Some themes force label{display:block}. Ensure our choice labels stay horizontal. */
.gfb-form .gfb-choice{ display: inline-flex !important; }

/* Dark mode polish for forms: align with theme text colors */
html[data-bsd-theme="dark"] .gfb-form-wrapper,
body[data-bsd-theme="dark"] .gfb-form-wrapper,
[data-bsd-theme="dark"] .gfb-form-wrapper{ color: var(--bsd-text, #fff); }
html[data-bsd-theme="dark"] .gfb-form-wrapper .gfb-form,
body[data-bsd-theme="dark"] .gfb-form-wrapper .gfb-form,
[data-bsd-theme="dark"] .gfb-form-wrapper .gfb-form{ background: var(--gfb-form-bg, var(--bsd-surface, #0f141b)); }
html[data-bsd-theme="dark"] .gfb-form-wrapper input,
html[data-bsd-theme="dark"] .gfb-form-wrapper select,
html[data-bsd-theme="dark"] .gfb-form-wrapper textarea,
body[data-bsd-theme="dark"] .gfb-form-wrapper input,
body[data-bsd-theme="dark"] .gfb-form-wrapper select,
body[data-bsd-theme="dark"] .gfb-form-wrapper textarea,
[data-bsd-theme="dark"] .gfb-form-wrapper input,
[data-bsd-theme="dark"] .gfb-form-wrapper select,
[data-bsd-theme="dark"] .gfb-form-wrapper textarea{
  color: var(--bsd-text, #fff) !important;
}
html[data-bsd-theme="dark"] .gfb-form-wrapper input::placeholder,
html[data-bsd-theme="dark"] .gfb-form-wrapper textarea::placeholder,
body[data-bsd-theme="dark"] .gfb-form-wrapper input::placeholder,
body[data-bsd-theme="dark"] .gfb-form-wrapper textarea::placeholder,
[data-bsd-theme="dark"] .gfb-form-wrapper input::placeholder,
[data-bsd-theme="dark"] .gfb-form-wrapper textarea::placeholder{
  color: var(--bsd-muted, rgba(255,255,255,0.65)) !important;
}

/* Buttons */
.gfb-form .gfb-btn{
  background: var(--gfb-button-bg, #2271b1);
  color: var(--gfb-button-text, #fff);
  border: 1px solid var(--gfb-button-bg, #2271b1);
}
.gfb-form .gfb-btn:hover{ filter: brightness(0.95); }

/* Separator */
.gfb-field-separator{width:100%;}
.gfb-separator{ display:block; width:100%; height:0; border: none; border-top: 1px solid var(--gfb-border-color, #d0d0d0) !important; margin: 16px 0; }


/* Entry view (print-friendly) */
.gfb-entry-view{max-width:1000px;margin:16px auto;}
.gfb-entry-title{margin:0 0 12px 0;}
.gfb-entry-row{margin:6px 0;}
.gfb-entry-label{font-weight:600;}
.gfb-entry-value{white-space:pre-wrap;word-break:break-word;}
.gfb-entry-section{margin:14px 0 10px 0;}

/* Submissions table actions */
.gfb-entries-table .gfb-action-link{font-size:13px;opacity:.75;text-decoration:none;margin-left:6px;}
.gfb-entries-table .gfb-action-link:hover{opacity:1;text-decoration:underline;}
.gfb-entries-table .gfb-action-delete{color:#b00020;}
.gfb-entries-table .gfb-action-disabled{font-size:13px;opacity:.35;margin-left:6px;cursor:not-allowed;}
.gfb-entries-table .gfb-action-sep{opacity:.35;margin:0 6px;}
.gfb-entry-heading{margin:10px 0 6px 0;}
.gfb-entry-repeater-row{border:1px solid var(--gfb-border-color, var(--bsd-border, #e5e5e5));padding:8px;margin:8px 0;background:transparent;}
.gfb-entry-repeater-rowtitle{font-weight:600;margin-bottom:6px;}
.gfb-entry-actions{margin-top:14px;}

/* Dark mode: make entry views/tables match theme surfaces */
html[data-bsd-theme="dark"] .gfb-entry-view,
body[data-bsd-theme="dark"] .gfb-entry-view,
[data-bsd-theme="dark"] .gfb-entry-view{
  color: var(--bsd-text, rgba(255,255,255,.92));
}
html[data-bsd-theme="dark"] .gfb-entry-table th,
html[data-bsd-theme="dark"] .gfb-entry-table td,
body[data-bsd-theme="dark"] .gfb-entry-table th,
body[data-bsd-theme="dark"] .gfb-entry-table td,
[data-bsd-theme="dark"] .gfb-entry-table th,
[data-bsd-theme="dark"] .gfb-entry-table td{
  background: var(--bsd-surface, #111a2e);
  border-color: var(--bsd-border, rgba(255,255,255,.12));
  color: var(--bsd-text, rgba(255,255,255,.92));
}
html[data-bsd-theme="dark"] .gfb-entries-table .gfb-action-link,
body[data-bsd-theme="dark"] .gfb-entries-table .gfb-action-link,
[data-bsd-theme="dark"] .gfb-entries-table .gfb-action-link{
  color: var(--bsd-link, #8ab4ff);
}
html[data-bsd-theme="dark"] .gfb-entries-table .gfb-action-delete,
body[data-bsd-theme="dark"] .gfb-entries-table .gfb-action-delete,
[data-bsd-theme="dark"] .gfb-entries-table .gfb-action-delete{
  color: var(--gfb-danger, #ff6b6b);
}

/* Two-column layout option */
.gfb-entry-layout-two .gfb-entry-row{display:grid;grid-template-columns:220px 1fr;gap:12px;align-items:start;}
.gfb-entry-layout-two .gfb-entry-label{margin:0;}
.gfb-entry-layout-two .gfb-entry-value{margin:0;}
.gfb-entry-layout-two .gfb-entry-heading,
.gfb-entry-layout-two .gfb-entry-desc,
.gfb-entry-layout-two .gfb-separator,
.gfb-entry-layout-two .gfb-entry-repeater-rowtitle{grid-column:1 / -1;}


/* Submitted forms search UI */
.gfb-search-form{margin:0 0 16px 0;}
.gfb-entry-search{width:100%;max-width:none;}
.gfb-entry-search table.gfb-table{width:100%;max-width:none;}

.gfb-search-table{width:100%;border-collapse:collapse;max-width:none;}
.gfb-search-table th,.gfb-search-table td{padding:8px 10px;vertical-align:top;}
.gfb-search-table th{width:240px;text-align:left;font-weight:600;}
.gfb-search-table td{width:auto;}
.gfb-search-table input[type="text"],
.gfb-search-table input[type="date"],
.gfb-search-table input[type="number"],
.gfb-search-table select{max-width:420px;width:100%;box-sizing:border-box;text-align:left;}

/* Ensure results rows are transparent even if theme applies striping */
.gfb-entry-search .gfb-table tr,
.gfb-entry-search .gfb-table tbody tr:nth-child(even),
.gfb-entry-search .gfb-table tbody tr:nth-child(odd){
  background: transparent !important;
}


/* --- Force transparent backgrounds for search form + results (override theme zebra striping) --- */
.gfb-search-form table.gfb-search-table,
.gfb-search-form table.gfb-search-table tr,
.gfb-search-form table.gfb-search-table th,
.gfb-search-form table.gfb-search-table td,
.gfb-entry-search table.gfb-table,
.gfb-entry-search table.gfb-table tr,
.gfb-entry-search table.gfb-table th,
.gfb-entry-search table.gfb-table td{
  background: transparent !important;
}

/* ---- Forms Directory (Tabbed list) ---- */
.gfb-forms-directory-card{
  width: 90%;
  margin: 18px auto;
  background: var(--bsd-surface, #fff);
  border-radius: 16px;
  box-shadow: var(--bsd-shadow, 0 2px 14px rgba(0,0,0,0.06));
  border: 1px solid var(--bsd-border, rgba(0,0,0,0.06));
  padding: 14px 16px;
  box-sizing: border-box;
}
.gfb-forms-directory{width:100%;}

.gfb-forms-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 10px 0;}

.gfb-forms-directory-title{
  margin: 0 0 14px 0;
  font-size: 1.6em;
  font-weight: 800;
  color: var(--bsd-text, #233244);
}
/* Theme styles often target all <button>. Force our tab buttons to look like tabs in both modes. */
.gfb-forms-tabs .gfb-tab{
  appearance:none;
  border: 1px solid var(--bsd-border, #d0d0d0) !important;
  background: var(--bsd-surface, #f6f7f7) !important;
  color: var(--bsd-text, #233244) !important;
  border-radius: 10px !important;
  padding: 8px 10px !important;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.1;
}
.gfb-forms-tabs .gfb-tab.is-active{
  background: var(--bsd-button-bg, #2271b1) !important;
  color: var(--bsd-button-text, #fff) !important;
  border-color: var(--bsd-button-bg, #2271b1) !important;
}

.gfb-forms-table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;}
/* Robust striping: apply to cells too to defeat theme zebra-striping. */
.gfb-forms-table tbody tr.gfb-row-odd td,
.gfb-forms-table tbody tr:nth-child(odd) td{background: rgba(0,0,0,0.03) !important;}
.gfb-forms-table tbody tr.gfb-row-even td,
.gfb-forms-table tbody tr:nth-child(even) td{background: transparent !important;}
.gfb-form-row td{padding:16px 14px;vertical-align:top;}
.gfb-form-title{font-weight:700;}
.gfb-form-desc{color: var(--bsd-muted, #667085);font-size:0.66em;line-height:1.35;margin-top:3px;max-width: 70ch;}
.gfb-forms-table td.gfb-form-actions{white-space:nowrap;text-align:right !important;}

/* Dark mode: use theme variables; keep striping subtle. */
[data-bsd-theme="dark"] .gfb-forms-table tbody tr.gfb-row-odd td,
[data-bsd-theme="dark"] .gfb-forms-table tbody tr:nth-child(odd) td{background: rgba(255,255,255,0.05) !important;}

/* Dark mode: ensure all rows use light text (some themes set odd rows to black). */
[data-bsd-theme="dark"] .gfb-forms-table td{color: var(--bsd-text, #fff) !important;}
[data-bsd-theme="dark"] .gfb-forms-table td *{color: inherit;}
[data-bsd-theme="dark"] .gfb-form-desc{color: var(--bsd-muted, #c0c7d1) !important;}

/* Dark mode: keep action links (Fill Out / Responses) white even for visited links */
[data-bsd-theme="dark"] .gfb-forms-table a,
[data-bsd-theme="dark"] .gfb-forms-table a:visited{
  color: var(--bsd-text, #fff) !important;
}
[data-bsd-theme="dark"] .gfb-forms-table a:hover{
  color: var(--bsd-text, #fff) !important;
  text-decoration: underline;
}

@media (max-width: 640px){
  .gfb-forms-table .gfb-form-desc{display:none !important;}
}

/* Dynamic page titles (Fill Out / Responses pages) */
.gfb-form-page-title{
  margin: 0 0 16px 0;
  font-size: 1.8em;
  font-weight: 800;
  text-align: center;
  color: var(--bsd-text, #233244);
}
[data-bsd-theme="dark"] .gfb-form-page-title{color: var(--bsd-text, #fff);}



/* Ensure submissions/responses lists stretch full width */
.gfb-form-submissions, .gfb-form-submissions .gfb-table, .gfb-form-submissions table.gfb-table {
  width: 100% !important;
  max-width: none !important;
}
.gfb-form-submissions .gfb-table td, .gfb-form-submissions .gfb-table th {
  background: transparent;
}
