/*
 * Public Page Styles
 * Modern, minimal, neutral — designed to look native on any website.
 * Brand-overridable via CSS custom properties set in the EJS template.
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--gr-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--gr-body-color, #1e1e1e);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Draft banner ===== */

.gr-draft-banner {
  background: #fffbeb;
  color: #92400e;
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-bottom: 1px solid #fde68a;
}

/* ===== Standalone page layout ===== */

body.gr-standalone {
  background: var(--gr-bg, #f4f3ee);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Embed layout ===== */

body.gr-embed {
  background: transparent;
}

body.gr-embed.gr-embed-card {
  background: #fff;
  border: 1px solid #f0f0f0;
}

body.gr-embed .gr-main {
  padding: 20px;
  max-width: 100%;
}

/* ===== Embed header (optional title/description inside embed) ===== */

.gr-embed-header {
  padding: 20px 20px 0;
}

.gr-embed-title {
  font-size: 17px;
  font-weight: 600;
  color: #1e1e1e;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.gr-embed-description {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

/* ===== Standalone header ===== */

.gr-header {
  width: 100%;
  max-width: var(--gr-content-width, 560px);
  padding: 48px 24px 0;
}

.gr-header-image {
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  margin-bottom: 28px;
}

.gr-header-content {
  text-align: center;
}

.gr-logo {
  max-height: 40px;
  max-width: 160px;
  margin-bottom: 20px;
}

.gr-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gr-title-color, #111);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.gr-description {
  font-size: 15px;
  color: var(--gr-desc-color, #6b7280);
  line-height: 1.5;
}

/* ===== Main content ===== */

.gr-main {
  width: 100%;
  max-width: var(--gr-content-width, 560px);
  padding: 32px 24px 56px;
}

/* Card container — wraps the form when card background is set */
.gr-card-container {
  background: var(--gr-card-bg, transparent);
  border-radius: var(--gr-card-radius, 0);
  border: 1px solid var(--gr-card-border, transparent);
  padding: 32px;
}

/* ===== Form ===== */

#gr-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gr-density-gap, 24px);
}

/* ===== Field wrappers ===== */

.gr-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gr-field-full {
  width: 100%;
}

.gr-field-half {
  width: calc(50% - 10px);
}

@media (max-width: 560px) {
  .gr-field-half {
    width: 100%;
  }
}

/* ===== Labels ===== */

.gr-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gr-label-color, #374151);
  letter-spacing: 0.01em;
}

.gr-required {
  color: #ef4444;
  margin-left: 1px;
}

/* ===== Inputs ===== */

.gr-field input[type="text"],
.gr-field input[type="email"],
.gr-field input[type="number"],
.gr-field input[type="date"],
.gr-field input[type="tel"],
.gr-field textarea,
.gr-field select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  font-size: 15px;
  font-family: inherit;
  color: var(--gr-input-color, #1e1e1e);
  background: var(--gr-input-bg, #fff);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.gr-field input::placeholder,
.gr-field textarea::placeholder {
  color: #a1a1aa;
}

.gr-field input:focus,
.gr-field textarea:focus,
.gr-field select:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.15);
}

.gr-field textarea {
  resize: vertical;
  min-height: 88px;
}

.gr-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.gr-field select[multiple] {
  min-height: 88px;
  background-image: none;
  padding-right: 14px;
}

/* ===== Checkbox ===== */

.gr-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}

.gr-checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gr-btn-color, var(--gr-primary, #6366f1));
  border-radius: 4px;
  cursor: pointer;
}

.gr-checkbox-wrapper label {
  cursor: pointer;
}

/* ===== File input ===== */

.gr-field input[type="file"] {
  padding: 10px 14px;
  font-size: 13px;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
  color: #6b7280;
}

.gr-field input[type="file"]:hover {
  border-color: #a5b4fc;
  background: #f5f5ff;
}

/* ===== Help text ===== */

.gr-help {
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.4;
}

/* ===== Field-level validation errors ===== */

.gr-field-error {
  font-size: 12px;
  color: #ef4444;
  min-height: 0;
}

.gr-field-error:empty {
  display: none;
}

/* ===== Form-level error ===== */

.gr-form-error {
  width: 100%;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #dc2626;
  font-size: 13px;
  line-height: 1.5;
}

/* ===== Submit button ===== */

.gr-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 32px;
  background: var(--gr-btn-color, var(--gr-primary, #18181b));
  color: var(--gr-btn-text, #fff);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  border: none;
  border-radius: var(--gr-btn-radius, 10px);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
  margin-top: 4px;
}

.gr-submit-btn.gr-btn-full {
  width: 100%;
}

.gr-submit-btn:hover {
  opacity: 0.88;
}

.gr-submit-btn:active {
  transform: scale(0.98);
}

.gr-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== Layout elements (headings, paragraphs in form) ===== */

.gr-layout-heading {
  width: 100%;
  font-size: 18px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.01em;
  margin-top: 4px;
}

.gr-layout-paragraph {
  width: 100%;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.6;
}

/* ===== Multi-step section navigation ===== */

.gr-section-nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

.gr-section-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.gr-section-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.gr-section-btn-primary {
  background: var(--gr-btn-color, var(--gr-primary, #18181b));
  color: #fff;
  border-color: transparent;
}

.gr-section-btn-primary:hover {
  opacity: 0.88;
  background: var(--gr-btn-color, var(--gr-primary, #18181b));
}

/* ===== Loading state ===== */

.gr-loading {
  text-align: center;
  padding: 56px 24px;
  color: #6b7280;
  font-size: 14px;
}

.gr-loading::before {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  border: 2.5px solid #e5e7eb;
  border-top-color: #6b7280;
  border-radius: 50%;
  animation: gr-spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes gr-spin {
  to { transform: rotate(360deg); }
}

/* ===== Success state ===== */

.gr-success {
  text-align: center;
  padding: 56px 24px;
}

.gr-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: #ecfdf5;
  border-radius: 50%;
  margin-bottom: 16px;
}

.gr-success-icon::after {
  content: '✓';
  font-size: 20px;
  color: #059669;
  font-weight: 600;
}

.gr-success h2 {
  font-size: 18px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.gr-success p {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
}

/* ===== Result display ===== */

.gr-result {
  padding: 20px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
}

.gr-result table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.gr-result th, .gr-result td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

.gr-result th {
  font-weight: 600;
  color: #374151;
  background: transparent;
}

/* ===== Empty state (display pages) ===== */

.gr-empty-state {
  text-align: center;
  padding: 56px 24px;
  color: #9ca3af;
  font-size: 14px;
}

/* ===== Display page — fluid layout ===== */

body.gr-standalone.gr-display-page .gr-header,
body.gr-standalone.gr-display-page .gr-main {
  max-width: min(92vw, 1200px);
}

body.gr-standalone.gr-display-page .gr-main {
  padding: 40px 48px 64px;
}

@media (max-width: 768px) {
  body.gr-standalone.gr-display-page .gr-main {
    padding: 24px 20px 48px;
  }
}

/* ===== Display page blocks ===== */

#gr-display {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#gr-display .gr-layout-heading {
  color: var(--gr-title-color, #111);
}

#gr-display .gr-layout-paragraph {
  color: var(--gr-desc-color, #6b7280);
}

.gr-display-output {
  font-size: 15px;
  line-height: 1.7;
  color: var(--gr-body-color, #1e1e1e);
}

.gr-display-output h1,
.gr-display-output h2,
.gr-display-output h3,
.gr-display-output h4 {
  color: var(--gr-title-color, #111);
  margin: 0.8em 0 0.35em;
  line-height: 1.3;
}

.gr-display-output h1 { font-size: 1.6em; }
.gr-display-output h2 { font-size: 1.35em; }
.gr-display-output h3 { font-size: 1.15em; }

.gr-display-output p {
  margin: 0.5em 0;
}

.gr-display-output ul,
.gr-display-output ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.gr-display-output li {
  margin: 0.25em 0;
}

.gr-display-output a {
  color: var(--gr-primary, #6366f1);
  text-decoration: underline;
}

/* Tables — scrollable container for wide data */
.gr-display-output .gr-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border: 1px solid var(--gr-card-border, #e5e7eb);
  border-radius: 8px;
}

.gr-display-output table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  margin: 0;
}

.gr-display-output th,
.gr-display-output td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gr-card-border, #f3f4f6);
  font-size: 14px;
  white-space: nowrap;
}

.gr-display-output th {
  font-weight: 600;
  color: var(--gr-title-color, #374151);
  background: rgba(0, 0, 0, 0.02);
  position: sticky;
  top: 0;
}

.gr-display-output td {
  white-space: normal;
  min-width: 100px;
}

.gr-display-output tr:last-child td {
  border-bottom: none;
}

@media (max-width: 768px) {
  .gr-display-output th,
  .gr-display-output td {
    padding: 8px 12px;
    font-size: 13px;
  }
}

.gr-display-output img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
}

.gr-display-output pre {
  background: rgba(0, 0, 0, 0.04);
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.gr-display-output code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
}

.gr-display-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--gr-card-radius, 8px);
  display: block;
}

.gr-display-divider {
  border: none;
  border-top: 1px solid var(--gr-card-border, #e5e7eb);
  margin: 4px 0;
}

/* ===== Third-width field ===== */

.gr-field-third {
  width: calc(33.333% - 14px);
}

@media (max-width: 560px) {
  .gr-field-third {
    width: 100%;
  }
}

/* ===== Shared field label (non-<label> label for complex types) ===== */

.gr-field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gr-label-color, #374151);
  letter-spacing: 0.01em;
}

/* ===== Multiselect chip list ===== */

.gr-multiselect {
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  background: var(--gr-input-bg, #fff);
  padding: 8px 12px;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gr-multiselect-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--gr-input-color, #1e1e1e);
  cursor: pointer;
  padding: 3px 0;
}

.gr-multiselect-row:hover { color: var(--gr-primary, #6366f1); }

/*
 * Option rows (multiselect / radio / checkbox group) are <label> elements, so
 * the generic `.gr-field label` rule would otherwise paint their text with the
 * field-label color (--gr-label-color). Option text is value content, not a
 * field label, so anchor it to the input text color with a higher-specificity
 * selector. Without this, a light --gr-label-color (e.g. on a dark card theme)
 * renders option text invisibly against the white input background.
 */
.gr-field .gr-multiselect-row,
.gr-field .gr-radio-row {
  color: var(--gr-input-color, #1e1e1e);
}

.gr-multiselect-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--gr-btn-color, var(--gr-primary, #6366f1));
  flex-shrink: 0;
  cursor: pointer;
}

/* ===== Radio and checkbox groups ===== */

.gr-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gr-radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--gr-input-color, #1e1e1e);
  cursor: pointer;
  padding: 8px 14px;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  background: var(--gr-input-bg, #fff);
  transition: border-color 0.15s;
}

.gr-radio-row:hover { border-color: #a5b4fc; }

.gr-radio-row input[type="radio"],
.gr-radio-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gr-btn-color, var(--gr-primary, #6366f1));
  flex-shrink: 0;
  cursor: pointer;
}

/* ===== Rating ===== */

.gr-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.gr-rating-star {
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}

.gr-rating-star:hover,
.gr-rating-star.active {
  color: #f59e0b;
  border-color: #f59e0b;
  background: #fffbeb;
}

.gr-rating-label {
  font-size: 12px;
  color: #9ca3af;
  margin: 0 4px;
}

/* ===== Slider ===== */

.gr-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gr-slider-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--gr-primary, #6366f1);
  text-align: center;
}

.gr-slider {
  width: 100%;
  height: 6px;
  accent-color: var(--gr-btn-color, var(--gr-primary, #6366f1));
  cursor: pointer;
}

.gr-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9ca3af;
}

/* ===== Date range ===== */

.gr-daterange {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gr-daterange-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gr-daterange-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gr-label-color, #374151);
}

.gr-daterange-group input[type="date"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  font-size: 14px;
  font-family: inherit;
  color: var(--gr-input-color, #1e1e1e);
  background: var(--gr-input-bg, #fff);
}

.gr-daterange-group input:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.15);
}

@media (max-width: 400px) {
  .gr-daterange { grid-template-columns: 1fr; }
}

/* ===== Tags ===== */

.gr-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  min-height: 48px;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  background: var(--gr-input-bg, #fff);
  cursor: text;
}

.gr-tags-wrap:focus-within {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.15);
}

.gr-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #ede9fe;
  color: #4f46e5;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.gr-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #7c3aed;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
}

.gr-tag-remove:hover { color: #dc2626; }

.gr-tags-input-field {
  flex: 1;
  min-width: 100px;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  background: transparent;
  color: var(--gr-input-color, #1e1e1e);
}

/* ===== Address ===== */

.gr-address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gr-address-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gr-address-full {
  grid-column: 1 / -1;
}

.gr-address-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gr-label-color, #374151);
}

.gr-address-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  font-size: 14px;
  font-family: inherit;
  color: var(--gr-input-color, #1e1e1e);
  background: var(--gr-input-bg, #fff);
}

.gr-address-field input:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.15);
}

@media (max-width: 480px) {
  .gr-address-grid { grid-template-columns: 1fr; }
}

/* ===== Signature ===== */

.gr-signature-wrap {
  position: relative;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  background: var(--gr-input-bg, #fff);
  overflow: hidden;
}

.gr-signature-canvas {
  display: block;
  width: 100%;
  height: 160px;
  cursor: crosshair;
  touch-action: none;
}

.gr-signature-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  background: rgba(255,255,255,0.9);
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
}

.gr-signature-clear:hover { color: #dc2626; border-color: #fecaca; }

.gr-signature-hint {
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
  margin-top: 4px;
}

/* ===== Rich text editor ===== */

.gr-rich-text-wrap {
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  overflow: hidden;
  background: var(--gr-input-bg, #fff);
}

.gr-rich-text-wrap:focus-within {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.15);
}

.gr-rich-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid #f3f4f6;
  background: #fafafa;
}

.gr-rich-toolbar-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  font-family: inherit;
}

.gr-rich-toolbar-btn:hover { background: #e5e7eb; }

.gr-rich-toolbar-sep {
  width: 1px;
  height: 16px;
  background: #e5e7eb;
  margin: 0 2px;
}

.gr-rich-editor {
  min-height: 100px;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--gr-input-color, #1e1e1e);
  outline: none;
  line-height: 1.6;
}

.gr-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #a1a1aa;
  pointer-events: none;
}

/* ===== Matrix / Likert tables ===== */

.gr-matrix-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gr-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.gr-matrix-table th,
.gr-matrix-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid #f3f4f6;
}

.gr-matrix-table th {
  font-weight: 600;
  font-size: 12px;
  color: #6b7280;
  background: #fafafa;
}

.gr-matrix-table tbody td:first-child {
  text-align: left;
  font-weight: 500;
  color: #374151;
}

.gr-matrix-table input[type="radio"],
.gr-matrix-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gr-btn-color, var(--gr-primary, #6366f1));
  cursor: pointer;
}

.gr-matrix-table tbody tr:hover { background: #fafafa; }

/* ===== Ranking ===== */

.gr-ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
}

.gr-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  background: var(--gr-input-bg, #fff);
  user-select: none;
}

.gr-ranking-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.gr-ranking-btn {
  background: #f3f4f6;
  border: none;
  width: 22px;
  height: 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gr-ranking-btn:hover { background: #e5e7eb; color: #111; }

.gr-ranking-text {
  font-size: 14px;
  color: var(--gr-input-color, #1e1e1e);
}

/* ===== Image choice ===== */

.gr-image-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.gr-image-choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  border: 2px solid var(--gr-input-border, #e5e7eb);
  border-radius: 10px;
  cursor: pointer;
  background: var(--gr-input-bg, #fff);
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.gr-image-choice-card:hover { border-color: #a5b4fc; }

.gr-image-choice-card.selected {
  border-color: var(--gr-primary, #6366f1);
  background: #eef2ff;
}

.gr-image-choice-img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}

.gr-image-choice-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

/* ===== Calculated (read-only) ===== */

.gr-calculated-display {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: var(--gr-input-radius, 10px);
  font-size: 15px;
  font-weight: 600;
  color: var(--gr-primary, #6366f1);
  background: #f5f5ff;
  font-family: inherit;
  cursor: default;
}

/* ===== Placeholder notices (repeater, payment, captcha) ===== */

.gr-placeholder-notice {
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
}

/* ===== Additional input type overrides ===== */

.gr-field input[type="url"],
.gr-field input[type="time"],
.gr-field input[type="datetime-local"],
.gr-field input[type="color"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gr-input-border, #e5e7eb);
  border-radius: var(--gr-input-radius, 10px);
  font-size: 15px;
  font-family: inherit;
  color: var(--gr-input-color, #1e1e1e);
  background: var(--gr-input-bg, #fff);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.gr-field input[type="color"] {
  padding: 4px;
  width: 48px;
  height: 44px;
  cursor: pointer;
}

.gr-field input[type="url"]:focus,
.gr-field input[type="time"]:focus,
.gr-field input[type="datetime-local"]:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.15);
}

/* ===== Error pages ===== */

.gr-error-page {
  text-align: center;
  padding: 80px 24px;
}

.gr-error-page h1 {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.gr-error-page p {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
}
