/* ============================================================
   VNPT Survey Portal – Global Styles
   ============================================================ */

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

:root {
  --primary:       #1a56db;
  --primary-dark:  #1341b4;
  --primary-light: #e8f0fe;
  --secondary:     #0e9f6e;
  --accent:        #f59e0b;
  --danger:        #ef4444;
  --surface:       #ffffff;
  --bg:            #f8fafc;
  --bg-alt:        #f1f5f9;
  --border:        #e2e8f0;
  --text-base:     #1e293b;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,.10), 0 8px 32px rgba(0,0,0,.08);
  --transition:    0.2s ease;
  --font:          'Inter', 'Noto Sans Lao', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-base);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Push the footer to the bottom when page content is short. */
.site-footer { margin-top: auto; }

a { color: inherit; text-decoration: none; }

/* Form controls don't inherit font-family by default — make them use the
   app font (incl. Noto Sans Lao) so Lao glyphs render correctly everywhere. */
button, input, select, textarea, optgroup {
  font-family: inherit;
}

img { max-width: 100%; }

/* ── Layout ─────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-base);
  line-height: 1.2;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,86,219,.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-alt);
  color: var(--text-base);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text-base);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-success {
  background: var(--secondary);
  color: #fff;
}

.btn-success:hover { background: #087f5b; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,.35); }

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-lg { padding: 13px 28px; font-size: 15px; }

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1a56db 0%, #0e4baf 50%, #0a3d8f 100%);
  color: #fff;
  padding: 72px 0 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-inner { position: relative; z-index: 1; }

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,.8);
  max-width: 580px;
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-actions { display: flex; gap: 12px; margin-bottom: 48px; flex-wrap: wrap; }

.hero-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.stat-item { display: flex; flex-direction: column; }
.stat-num { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: rgba(255,255,255,.7); margin-top: 2px; }
.stat-divider { width: 1px; height: 36px; background: rgba(255,255,255,.2); }

/* ── Sections ─────────────────────────────────────────────── */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  color: var(--text-base);
  margin-bottom: 12px;
}

.section-desc {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ── Entity Cards (Home) ─────────────────────────────────── */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 24px;
}

.entity-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.entity-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.entity-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ministry-icon { background: var(--primary-light); color: var(--primary); }
.province-icon { background: #ecfdf5; color: var(--secondary); }
.mtc-icon { background: #f3e8ff; color: #7c3aed; }

.entity-info { flex: 1; }

.entity-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-base);
}

.entity-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.entity-forms { display: flex; flex-wrap: wrap; gap: 6px; }

.form-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.entity-arrow {
  font-size: 20px;
  color: var(--text-light);
  transition: var(--transition);
  align-self: center;
}

.entity-card:hover .entity-arrow { color: var(--primary); transform: translateX(4px); }

/* ── Topic Cards ─────────────────────────────────────────── */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}

.topic-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.topic-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.icon-blue   { background: var(--primary-light); color: var(--primary); }
.icon-green  { background: #ecfdf5; color: #059669; }
.icon-purple { background: #f5f3ff; color: #7c3aed; }
.icon-red    { background: #fef2f2; color: #dc2626; }
.icon-orange { background: #fffbeb; color: #d97706; }
.icon-teal   { background: #f0fdfa; color: #0d9488; }

.topic-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-base);
}

.topic-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
  background: #1e293b;
  color: rgba(255,255,255,.7);
  padding: 32px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-tagline { font-size: 12px; margin-top: 4px; }

.footer-copy { font-size: 13px; }

.footer-admin-link {
  margin-left: 10px;
  font-size: 12px;
  color: rgba(255,255,255,.55);
  text-decoration: underline;
  transition: var(--transition);
}
.footer-admin-link:hover { color: #fff; }

/* ============================================================
   SURVEY PAGE LAYOUT
   ============================================================ */

.survey-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 64px);
  gap: 0;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.survey-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-entity-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.badge-ministry { background: var(--primary-light); color: var(--primary); }
.badge-province { background: #ecfdf5; color: var(--secondary); }
.badge-mtc { background: #f3e8ff; color: #7c3aed; }

.sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-base);
}

.sidebar-progress-wrap { margin-top: 10px; }

.sidebar-progress-bar {
  height: 4px;
  background: var(--bg-alt);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.sidebar-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .4s ease;
}

.sidebar-progress-label { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { padding: 0 12px; }

.sidebar-section-group { margin-bottom: 8px; }

.sidebar-section-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  text-align: left;
}

.sidebar-section-btn:hover { background: var(--bg-alt); color: var(--text-base); }

.sidebar-section-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-section-btn.completed { color: var(--secondary); }

.sidebar-section-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar-section-btn.active .sidebar-section-num {
  background: var(--primary);
  color: #fff;
}

.sidebar-section-btn.completed .sidebar-section-num {
  background: var(--secondary);
  color: #fff;
}

.sidebar-section-text { flex: 1; line-height: 1.3; }

.sidebar-section-code {
  font-size: 10px;
  font-weight: 400;
  display: block;
  color: var(--text-light);
}

/* ── Main Content ─────────────────────────────────────────── */
.survey-main {
  background: var(--bg);
  overflow-y: auto;
}

.survey-main-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 32px 80px;
}

/* ── Section Panel ─────────────────────────────────────────── */
.section-panel {
  display: none;
  animation: fadeIn .25s ease;
}

.section-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Form Heading ─────────────────────────────────────────── */
.form-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.form-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.form-code-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-base);
  margin: 6px 0;
}

.form-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-base);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Form Controls ─────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-base);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-base);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
  resize: vertical;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}

.form-control::placeholder { color: var(--text-light); }

textarea.form-control { min-height: 90px; }

select.form-control { cursor: pointer; }

/* ── Checkbox & Radio ─────────────────────────────────────── */
.check-group { display: flex; flex-direction: column; gap: 8px; }

.check-group.inline { flex-direction: row; flex-wrap: wrap; gap: 12px; }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.check-item input[type="checkbox"],
.check-item input[type="radio"] {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.check-label {
  font-size: 14px;
  color: var(--text-base);
  line-height: 1.4;
}

.check-label small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Toggle (Yes/No/Unknown) ─────────────────────────────── */
.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-btn {
  padding: 7px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-muted);
  transition: var(--transition);
}

.toggle-btn:hover { border-color: var(--primary); color: var(--primary); }

.toggle-btn.selected-yes { background: #ecfdf5; border-color: var(--secondary); color: var(--secondary); }
.toggle-btn.selected-no  { background: #fef2f2; border-color: var(--danger);    color: var(--danger); }
.toggle-btn.selected-unk { background: #fffbeb; border-color: var(--accent);    color: var(--accent); }

/* ── Grid Inputs ─────────────────────────────────────────── */
.form-row {
  display: grid;
  gap: 16px;
}
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ── Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-top: 4px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-alt);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-base);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--bg-alt); }

.data-table .form-control {
  padding: 6px 9px;
  font-size: 13px;
  min-height: unset;
}

.table-add-btn {
  margin-top: 10px;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  width: 100%;
  text-align: center;
  transition: var(--transition);
}

.table-add-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ── Section Divider ─────────────────────────────────────── */
.subsection-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 8px;
  margin: 24px 0 16px;
}

/* ── Info Box ─────────────────────────────────────────────── */
.info-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #1e40af;
  margin-bottom: 20px;
  line-height: 1.6;
}

.info-box strong { font-weight: 700; }

/* ── Step Indicator (Wizard top bar on mobile) ─────────────── */
.steps-bar {
  display: none;
  overflow-x: auto;
  padding: 16px 20px;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.step-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  transition: var(--transition);
}

.step-item.active .step-dot  { border-color: var(--primary); background: var(--primary); color: #fff; }
.step-item.done   .step-dot  { border-color: var(--secondary); background: var(--secondary); color: #fff; }

.step-line {
  width: 32px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

.step-item.done + .step-item .step-line { background: var(--secondary); }

/* ── Navigation Buttons ─────────────────────────────────── */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 28px;
  margin-top: 28px;
  border-top: 1px solid var(--border);
}

.form-nav-left { display: flex; gap: 10px; }
.form-nav-right { display: flex; gap: 10px; }

/* ── Save Banner ─────────────────────────────────────────── */
.save-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(10px);
  transition: .3s ease;
  pointer-events: none;
}

.save-banner.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ── Status Badge ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.status-yes  { background: #ecfdf5; color: #059669; }
.status-no   { background: #fef2f2; color: #dc2626; }
.status-wip  { background: #fffbeb; color: #d97706; }

/* ── Completion Screen ─────────────────────────────────────── */
.completion-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 36px;
  text-align: center;
  max-width: 600px;
  margin: 40px auto;
}

.completion-icon {
  width: 72px;
  height: 72px;
  background: #ecfdf5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--secondary);
}

.completion-title { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.completion-desc  { font-size: 15px; color: var(--text-muted); margin-bottom: 28px; line-height: 1.6; }

/* ── Glossary ─────────────────────────────────────────────── */
.glossary-table { font-size: 13px; }

.glossary-table td:first-child { font-weight: 600; white-space: nowrap; width: 180px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .survey-layout {
    grid-template-columns: 1fr;
  }

  .survey-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: none;
  }

  .survey-sidebar.open { display: block; }

  .steps-bar { display: flex; }

  .survey-main-inner { padding: 24px 16px 60px; }
}

@media (max-width: 768px) {
  .entity-grid { grid-template-columns: 1fr; }

  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }

  .hero { padding: 48px 0 56px; }

  /* Header stacks: logo on top, nav wraps below — stays accessible on mobile. */
  .header-inner { height: auto; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
  .header-nav { width: 100%; flex-wrap: wrap; gap: 6px; }
  .nav-link { padding: 6px 12px; }

  .form-nav { flex-direction: column-reverse; gap: 12px; align-items: stretch; }
  .form-nav-left, .form-nav-right { justify-content: center; }

  .dash-header { flex-direction: column; align-items: stretch; }
  .dash-header .btn { width: 100%; justify-content: center; }
  .builder-inner { padding: 0 14px; }
  .builder-toolbar { flex-wrap: wrap; }
  .builder-toolbar-right { width: 100%; }
  .builder-toolbar-right .btn { flex: 1; justify-content: center; }
}

/* ── Date Picker ─────────────────────────────────────────── */
.dp-wrap {
  position: relative;
}

.dp-input-row {
  position: relative;
  display: flex;
  align-items: center;
}

.dp-input-row .form-control {
  padding-right: 38px;
  cursor: pointer;
  caret-color: transparent;
}

.dp-input-row .form-control:read-only {
  background: var(--surface);
}

.dp-trigger {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: var(--transition);
  pointer-events: none;
}

.dp-input-row:hover .dp-trigger,
.dp-input-row .form-control:focus ~ .dp-trigger {
  color: var(--primary);
}

.dp-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 600;
  width: 288px;
  padding: 14px;
  display: none;
}

.dp-popup.open {
  display: block;
  animation: dpFadeIn .14s ease;
}

@keyframes dpFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 6px;
}

.dp-nav-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 14px;
  line-height: 1;
}

.dp-nav-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.dp-month-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-base);
  text-align: center;
  flex: 1;
  user-select: none;
}

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.dp-wd {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-base);
  transition: background .12s ease, color .12s ease;
  border: none;
  background: none;
  font-family: var(--font);
  font-weight: 400;
  padding: 0;
}

.dp-day:hover:not(.dp-empty):not(.dp-selected) {
  background: var(--primary-light);
  color: var(--primary);
}

.dp-today:not(.dp-selected) {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
}

.dp-selected {
  background: var(--primary);
  color: #fff !important;
  font-weight: 600;
}

.dp-empty {
  cursor: default;
  pointer-events: none;
}

.dp-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dp-today-btn,
.dp-clear-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: none;
  transition: var(--transition);
  font-family: var(--font);
}

.dp-today-btn {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--primary-light);
}

.dp-today-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.dp-clear-btn {
  color: var(--text-muted);
}

.dp-clear-btn:hover {
  background: #fef2f2;
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================================
   FORM BUILDER  (builder.html / forms.html / fill.html)
   ============================================================ */

/* ── Dashboard ─────────────────────────────────────────────── */
.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.dash-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.dash-toolbar #searchInput { flex: 2; min-width: 200px; }
.dash-toolbar select { flex: 1; min-width: 150px; max-width: 220px; cursor: pointer; }

.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.form-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.status-pill.is-published { background: #ecfdf5; color: #059669; }
.status-pill.is-draft     { background: var(--bg-alt); color: var(--text-muted); }

.publish-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-base);
  cursor: pointer;
}
.publish-toggle input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* ── Category manager modal ────────────────────────────────── */
.cat-mgr { max-width: 480px; }
.cat-mgr-list {
  list-style: none;
  margin: 6px 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.cat-row-label { flex: 1; font-size: 14px; color: var(--text-base); }
.cat-row-input { flex: 1; }
.cat-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cat-row-lock {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  background: var(--bg-alt); border-radius: 20px; padding: 3px 10px; flex-shrink: 0;
}
.cat-mgr-add { display: flex; gap: 8px; margin-bottom: 16px; }
.cat-mgr-add .form-control { flex: 1; }

.form-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.form-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.form-card-body { padding: 22px 22px 16px; flex: 1; }

.form-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.form-card-title { font-size: 16px; font-weight: 700; color: var(--text-base); line-height: 1.35; }

.form-card-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.form-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.form-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.form-card-meta { font-size: 12px; color: var(--text-light); }

.form-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
}

.act-danger { color: var(--danger); }
.act-danger:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }

/* ── Modal dialogs (uiPrompt / uiConfirm / uiAlert) ────────── */
.ui-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: uiFade .15s ease;
}
.ui-modal-overlay[hidden] { display: none; }
.ui-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  animation: uiPop .16s ease;
}
.ui-modal-title { font-size: 17px; font-weight: 700; color: var(--text-base); margin-bottom: 8px; }
.ui-modal-message { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.ui-modal-title[hidden], .ui-modal-message[hidden], .ui-modal-field[hidden] { display: none; }
.ui-modal-field { margin-bottom: 18px; }
.ui-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes uiFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes uiPop  { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ── Admin area accents ────────────────────────────────────── */
.admin-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 20px;
  padding: 3px 10px;
}

/* ── Responses view ────────────────────────────────────────── */
.response-card { padding: 18px 22px; }
.response-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.response-num {
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); border-radius: 20px; padding: 3px 12px;
}
.response-list { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 18px; margin: 0; }
.response-list dt { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.response-list dd { font-size: 14px; color: var(--text-base); margin: 0; word-break: break-word; }
.response-list dd a { color: var(--primary); text-decoration: underline; }
@media (max-width: 600px) {
  .response-list { grid-template-columns: 1fr; gap: 2px 0; }
  .response-list dd { margin-bottom: 10px; }
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; }

.empty-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}

.empty-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-desc  { font-size: 14px; color: var(--text-muted); max-width: 420px; margin: 0 auto; }

/* ── Builder layout ────────────────────────────────────────── */
.builder-wrap { background: var(--bg); min-height: calc(100vh - 64px); padding: 28px 0 80px; }
.builder-inner { max-width: 760px; margin: 0 auto; padding: 0 20px; }

.builder-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.builder-toolbar-right { margin-left: auto; display: flex; gap: 10px; }

.builder-status { font-size: 12px; font-weight: 600; color: var(--text-light); }
.builder-status.dirty { color: var(--accent); }
.builder-status.saved { color: var(--secondary); }

.builder-meta-card { border-top: 4px solid var(--primary); }

.builder-category { margin-top: 14px; }
.builder-category-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.builder-category-row .form-control { max-width: 320px; flex: 1; min-width: 180px; }

/* Custom (user-added) category colours */
.custom-icon  { background: var(--bg-alt); color: var(--text-muted); }
.badge-custom { background: var(--bg-alt); color: var(--text-muted); }

.builder-title-input {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--border);
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-base);
  padding: 4px 2px 10px;
  outline: none;
  background: none;
}
.builder-title-input:focus { border-bottom-color: var(--primary); }

.builder-desc-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-muted);
  padding: 10px 2px 4px;
  margin-top: 8px;
  outline: none;
  resize: vertical;
  background: none;
}
.builder-desc-input:focus { border-bottom-color: var(--primary); }

.builder-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 32px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* ── Field editor cards ────────────────────────────────────── */
.builder-field-list { margin-top: 20px; }

.field-card { border-left: 4px solid transparent; transition: border-color var(--transition); }
.field-card:focus-within { border-left-color: var(--primary); }

.field-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.field-card-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 6px;
  padding: 3px 8px;
  flex-shrink: 0;
}

.fc-label-input {
  flex: 1;
  border: none;
  border-bottom: 1.5px solid var(--border);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-base);
  padding: 6px 2px;
  outline: none;
  background: none;
}
.fc-label-input:focus { border-bottom-color: var(--primary); }

.fc-type-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-base);
  padding: 7px 10px;
  cursor: pointer;
  background: var(--surface);
  outline: none;
  flex-shrink: 0;
}
.fc-type-select:focus { border-color: var(--primary); }

/* options editor */
.fc-options { margin: 14px 0 4px; }
.fc-option-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fc-option-bullet { color: var(--text-light); font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.fc-option-input { flex: 1; }

.fc-option-del {
  border: none;
  background: none;
  color: var(--text-light);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 6px;
  transition: var(--transition);
}
.fc-option-del:hover { color: var(--danger); background: #fef2f2; }

.fc-add-option {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 2px;
  margin-top: 2px;
}
.fc-add-option:hover { text-decoration: underline; }

.fc-placeholder { margin: 14px 0 4px; }

.fc-date-note {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

/* Live answer preview inside a builder field card */
.fc-preview { margin: 14px 0 4px; }
.fc-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.fc-preview .note-editor.note-frame { margin-bottom: 0; }
.fc-preview .fp-wrap { max-width: 260px; }

.field-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.fc-required { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; }
.fc-required input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.field-card-tools { display: flex; gap: 4px; }

.fc-tool {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.fc-tool:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.fc-tool:disabled { opacity: .4; cursor: not-allowed; }
.fc-tool-danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

/* ── Add-question palette ──────────────────────────────────── */
.builder-palette {
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
}

.builder-palette-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.builder-palette-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.palette-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-base);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.palette-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.palette-icon { font-size: 14px; }

/* ── Fill / renderer page ──────────────────────────────────── */
.fill-container { max-width: 760px; }
.fill-head-card { border-top: 4px solid var(--primary); }
.fill-actions { display: flex; justify-content: flex-end; }

.builder-field-block.field-invalid {
  outline: 2px solid var(--danger);
  outline-offset: 6px;
  border-radius: var(--radius-sm);
}

/* ── Date picker (flatpickr) ───────────────────────────────── */
.fp-wrap { position: relative; }
.fp-wrap .form-control { padding-right: 38px; cursor: pointer; }
.fp-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
  opacity: .65;
}
.flatpickr-calendar {
  font-family: var(--font);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--primary);
  border-color: var(--primary);
}
.flatpickr-day:hover { background: var(--primary-light); border-color: var(--primary-light); }
.flatpickr-day.today { border-color: var(--primary); }
.flatpickr-months .flatpickr-month, .flatpickr-weekdays { color: var(--text-base); }
.flatpickr-current-month .flatpickr-monthDropdown-months { font-weight: 600; }

/* ── File upload (drag & drop) ─────────────────────────────── */
.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.file-drop:hover { border-color: var(--primary); background: var(--primary-light); }
.file-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.file-drop.is-preview { cursor: default; }
.file-drop-icon { color: var(--primary); margin-bottom: 8px; }
.file-drop-text { font-size: 14px; color: var(--text-base); font-weight: 500; }
.file-browse { color: var(--primary); font-weight: 700; text-decoration: underline; }
.file-drop-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  text-align: left;
}
.file-ico { font-size: 16px; flex-shrink: 0; }
.file-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.file-remove {
  border: none; background: none; color: var(--text-light);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px;
  flex-shrink: 0; transition: var(--transition);
}
.file-remove:hover { color: var(--danger); background: #fef2f2; }

/* ── Table question type ───────────────────────────────────── */
.data-table th.tbl-act, .data-table td.tbl-act { width: 36px; text-align: center; }
.tbl-row-del {
  border: none; background: none; color: var(--text-light);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
  transition: var(--transition);
}
.tbl-row-del:hover { color: var(--danger); background: #fef2f2; }
.data-table td.tbl-fixed { background: var(--bg-alt); font-weight: 500; color: var(--text-base); white-space: normal; word-break: break-word; }

/* Auto-growing table answer cells — wrap and show the full text. */
.data-table td .tbl-cell {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
}
.data-table th { white-space: normal; }
/* Column widths come from the per-column <colgroup>; the table sets its own
   min-width so on small screens it scrolls horizontally instead of collapsing. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Display blocks on the fill page ───────────────────────── */
.fill-section-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 26px 0 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}
.fill-section-heading:first-child { margin-top: 0; }
.fill-note { white-space: normal; }

/* ── Builder: display-block cards ──────────────────────────── */
.field-card.field-display { border-left: 4px solid var(--accent); background: #fffdf7; }
.fc-heading-input { font-weight: 700; font-size: 16px; }
.fc-note-input { font-family: var(--font); resize: vertical; }
.fc-display-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--accent); background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 20px; padding: 3px 10px;
}

/* ── Builder: structured table editor ──────────────────────── */
.fc-table-editor { margin: 14px 0 4px; }
.fc-tcols { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.fc-tcol-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fc-tcol-name { flex: 1; min-width: 140px; }
.fc-tcol-width { width: 96px; flex-shrink: 0; }
.fc-tcol-fill { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); white-space: nowrap; cursor: pointer; }
.fc-tcol-fill input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.fc-tcol-del {
  border: none; background: none; color: var(--text-light); font-size: 20px; line-height: 1;
  cursor: pointer; padding: 0 6px; border-radius: 6px; flex-shrink: 0;
}
.fc-tcol-del:hover { color: var(--danger); background: #fef2f2; }
.fc-tcol-add, .fc-trow-add {
  border: none; background: none; color: var(--primary); font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 6px 2px; align-self: flex-start; margin-top: 2px;
}
.fc-tcol-add:hover, .fc-trow-add:hover { text-decoration: underline; }
.fc-trows .th-fill { color: var(--primary); font-size: 11px; }
.fc-trows .fc-tcell { padding: 6px 8px; font-size: 13px; min-height: unset; }
.fc-trows .fc-tcell.is-fill { background: var(--primary-light); border-color: #bfdbfe; }
.fc-trow-del {
  border: none; background: none; color: var(--text-light); font-size: 18px; line-height: 1;
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.fc-trow-del:hover { color: var(--danger); background: #fef2f2; }
.fc-addrows-toggle {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
}
.fc-addrows-toggle input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ── Summernote integration (rich-text paragraph fields) ───── */
.note-editor.note-frame {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  overflow: hidden;
}
.note-editor.note-frame.focused { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.note-editor .note-toolbar { background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 6px 8px; }
.note-editor .note-editable { font-family: var(--font); font-size: 14px; color: var(--text-base); line-height: 1.6; background: var(--surface); }
.note-editor .note-editable img { max-width: 100%; border-radius: var(--radius-sm); }
.note-editor .note-placeholder { color: var(--text-light); font-size: 14px; }
.note-btn { font-family: var(--font); }
.note-modal .note-modal-content { font-family: var(--font); }

@media (max-width: 600px) {
  .field-card-top { flex-wrap: wrap; }
  .fc-type-select { width: 100%; }
  .form-card-actions .btn { flex: 1; }
}

/* ── Utility ─────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 12px; }
.mt-4        { margin-top: 16px; }
.mb-0        { margin-bottom: 0; }
.fw-semibold { font-weight: 600; }
