/* =========================================================
   App pages — dashboard, responses, templates
   ========================================================= */

/* ---------- dashboard ---------- */
.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.welcome-row h1 {
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.welcome-row h1 .wave {
  font-size: 0.9em;
  transform-origin: 70% 70%;
  animation: wave 2.4s infinite;
  display: inline-block;
}
@keyframes wave {
  0%, 55%, 100% { transform: rotate(0); }
  60% { transform: rotate(16deg); }
  70% { transform: rotate(-8deg); }
  80% { transform: rotate(12deg); }
  90% { transform: rotate(-4deg); }
}
.welcome-row p {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 5px;
}
.welcome-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.onboard-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  background:
    radial-gradient(ellipse 50% 180% at 10% 0%, rgba(16, 185, 129, 0.18), transparent 65%),
    linear-gradient(120deg, color-mix(in srgb, var(--brand) 10%, var(--card)), var(--card) 55%);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.onboard-banner .ob-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: var(--shadow-brand);
}
.onboard-banner .ob-icon svg { width: 22px; height: 22px; }
.onboard-banner h3 { font-size: 14px; margin-bottom: 2px; }
.onboard-banner p { font-size: 12px; color: var(--muted); line-height: 1.7; }
.onboard-banner .ob-progress {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}
.ob-meter {
  width: 160px;
  height: 7px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand) 12%, var(--bg-2));
  overflow: hidden;
}
.ob-meter i {
  display: block;
  height: 100%;
  width: 75%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--brand), var(--violet), var(--mint));
}
.onboard-banner .ob-pct {
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}
.ob-close {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--muted-2);
}
.ob-close:hover { background: var(--bg-2); color: var(--ink); }
.ob-close svg { width: 14px; height: 14px; }
@media (max-width: 760px) {
  .onboard-banner { padding-inline-end: 34px; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: 0.25s var(--ease);
}
.kpi-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.kpi-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.kpi-icon.mint { background: var(--mint-soft); color: var(--mint); }
.kpi-icon.coral { background: var(--coral-soft); color: var(--coral); }
.kpi-icon.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-top small {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.kpi-value {
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.kpi-value em {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
  margin-inline-start: 3px;
}
.kpi-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--muted-2);
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  color: var(--mint);
  background: var(--mint-soft);
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10px;
}
.kpi-delta.down { color: var(--coral); background: var(--coral-soft); }
.kpi-delta svg { width: 11px; height: 11px; }
.kpi-spark {
  position: absolute;
  inset-inline-end: 14px;
  bottom: 14px;
  width: 70px;
  height: 28px;
  opacity: 0.8;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 14px; font-weight: 800; }
.panel-head p { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.panel-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 7px; }
.seg-tabs {
  display: inline-flex;
  background: var(--bg-2);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg-tab {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 7px;
  color: var(--muted);
  transition: 0.16s;
}
.seg-tab.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.chart-body { padding: 16px 20px 12px; }
.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 8px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  display: inline-block;
}
.line-chart { width: 100%; height: auto; display: block; }
.line-chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.line-chart .axis-text { fill: var(--muted-2); font-size: 9px; font-family: var(--font); }
.line-chart .area-a { fill: url(#areaGradA); }
.line-chart .area-b { fill: url(#areaGradB); }
.line-chart .line-a { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.line-chart .line-b { fill: none; stroke: var(--mint); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.line-chart .dot-a { fill: var(--card); stroke: var(--brand); stroke-width: 2; }
.line-chart .dot-b { fill: var(--card); stroke: var(--mint); stroke-width: 2; }
.chart-insight {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  margin-top: 14px;
}
.chart-insight > div {
  background: var(--card);
  padding: 12px 16px;
}
.chart-insight span {
  font-size: 9.5px;
  color: var(--muted-2);
  display: block;
  margin-bottom: 2px;
}
.chart-insight b { font-size: 11.5px; color: var(--ink-2); }
.chart-insight b.up { color: var(--mint); }

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  flex-wrap: wrap;
}
.donut {
  width: 128px;
  height: 128px;
  flex: none;
  position: relative;
}
.donut svg { transform: rotate(-90deg); }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.donut-center b { font-size: 21px; font-weight: 900; letter-spacing: -0.03em; }
.donut-center span { font-size: 9px; color: var(--muted-2); }
.donut-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 120px; }
.donut-legend div {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
}
.donut-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.donut-legend b { margin-inline-start: auto; color: var(--ink-2); font-size: 11px; }

.activity-list { padding: 6px 10px 10px; max-height: 292px; overflow-y: auto; }
.activity-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 10px;
  border-radius: 10px;
  transition: background 0.15s;
}
.activity-item:hover { background: var(--bg); }
.activity-item .ai-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--brand-soft);
  color: var(--brand);
}
.activity-item .ai-avatar.mint { background: var(--mint-soft); color: var(--mint); }
.activity-item .ai-avatar.amber { background: var(--amber-soft); color: var(--amber); }
.activity-item .ai-avatar.coral { background: var(--coral-soft); color: var(--coral); }
.activity-item .ai-avatar svg { width: 15px; height: 15px; }
.activity-item .ai-body { flex: 1; min-width: 0; }
.activity-item p { font-size: 11.5px; line-height: 1.7; color: var(--ink-2); }
.activity-item p b { font-weight: 700; }
.activity-item time { font-size: 9.5px; color: var(--muted-2); display: block; margin-top: 2px; }
.activity-item .unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
  margin-top: 6px;
}

/* forms table */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 8px;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.filter-tab:hover { background: var(--bg-2); color: var(--ink); }
.filter-tab.active { background: var(--brand-soft); color: var(--brand); }
.filter-tab .n {
  font-size: 9px;
  background: var(--bg-2);
  color: var(--muted);
  padding: 0 5px;
  border-radius: 20px;
}
.filter-tab.active .n { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); }
.table-search {
  position: relative;
  width: min(220px, 100%);
  margin-inline-start: auto;
}
.table-search .icon {
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted-2);
}
.table-search input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 9px;
  padding: 0 32px 0 10px;
  font-size: 11.5px;
  outline: 0;
}
.table-search input:focus { border-color: var(--brand); background: var(--card); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: right;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
  padding: 11px 16px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  vertical-align: middle;
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.form-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.form-thumb {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--brand-soft);
  flex: none;
  display: grid;
  place-items: center;
  color: var(--brand);
}
.form-thumb img { width: 100%; height: 100%; object-fit: cover; }
.form-thumb svg { width: 18px; height: 18px; }
.form-cell .fc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  display: block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-cell .fc-sub {
  font-size: 9.5px;
  color: var(--muted-2);
  display: block;
  margin-top: 1px;
}
.fc-mobile-meta { display: none; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.published { color: #059669; background: var(--mint-soft); }
[data-theme="dark"] .status.published { color: var(--mint); }
.status.draft { color: #a16207; background: var(--amber-soft); }
[data-theme="dark"] .status.draft { color: var(--amber); }
.status.closed { color: var(--muted); background: var(--bg-2); }
.mini-progress {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 90px;
}
.mini-progress .mp-bar {
  flex: 1;
  height: 4px;
  border-radius: 6px;
  background: var(--bg-2);
  overflow: hidden;
}
.mini-progress .mp-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--brand), var(--violet));
}
.mini-progress b { font-size: 10px; font-weight: 600; color: var(--muted); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-actions .btn-icon { width: 30px; height: 30px; border-radius: 8px; }
.row-actions .btn-icon .icon { width: 15px; height: 15px; }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  font-size: 10.5px;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
}

/* dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  min-width: 170px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 30;
  display: none;
}
.dropdown-menu.open { display: block; animation: fadeIn 0.16s; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
  transition: 0.14s;
}
.dropdown-item:hover { background: var(--bg-2); color: var(--ink); }
.dropdown-item.danger { color: #dc2626; }
[data-theme="dark"] .dropdown-item.danger { color: #f87171; }
.dropdown-item.danger:hover { background: var(--coral-soft); }
.dropdown-item .icon { width: 15px; height: 15px; color: var(--muted-2); }
.dropdown-item.danger .icon { color: currentColor; }
.dropdown-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* quick templates */
.quick-tpl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
}
.quick-tpl-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  transition: 0.2s;
  display: flex;
  flex-direction: column;
}
.quick-tpl-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.quick-tpl-card img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg-2);
}
.quick-tpl-card .qt-body { padding: 9px 11px; }
.quick-tpl-card b { font-size: 10.5px; display: block; }
.quick-tpl-card small { font-size: 9px; color: var(--muted-2); }

.section-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px 0;
}
.section-mini-head h3 { font-size: 14px; }
.section-mini-head a { font-size: 11px; color: var(--brand); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

/* empty state */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-state .es-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--bg-2);
  color: var(--muted-2);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.empty-state .es-icon svg { width: 26px; height: 26px; }
.empty-state h3 { font-size: 15px; }
.empty-state p { font-size: 12px; color: var(--muted); max-width: 300px; line-height: 1.8; }

/* new form modal */
.template-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.picker-card {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
  transition: 0.16s;
  background: var(--card);
}
.picker-card:hover, .picker-card.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.picker-card img {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
  flex: none;
}
.picker-card .picker-icon {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: var(--bg-2);
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}
.picker-card .picker-icon svg { width: 21px; height: 21px; }
.picker-card b { font-size: 11px; display: block; }
.picker-card small { font-size: 9.5px; color: var(--muted-2); display: block; }

/* ---------- responses page ---------- */
.resp-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.resp-kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px 17px;
  display: flex;
  gap: 11px;
  align-items: center;
}
.resp-kpi .rk-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.resp-kpi .rk-icon svg { width: 17px; height: 17px; }
.resp-kpi b { font-size: 18px; display: block; line-height: 1.3; letter-spacing: -0.02em; }
.resp-kpi small { font-size: 10px; color: var(--muted); }

.resp-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.resp-toolbar .spacer { flex: 1; }

.filter-select {
  height: 36px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 9px;
  font-size: 11.5px;
  padding: 0 12px;
  color: var(--ink-2);
  outline: 0;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--brand); }

.resp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
}
.resp-list-panel { min-width: 0; }
.resp-list { max-height: 640px; overflow-y: auto; }
.resp-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
}
.resp-row:hover { background: var(--bg); }
.resp-row.active { background: var(--brand-soft); }
.resp-row.unread .rr-name::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  margin-inline-end: 6px;
  vertical-align: 1px;
}
.rr-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-soft), var(--mint-soft));
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  flex: none;
}
.resp-row .rr-body { flex: 1; min-width: 0; }
.resp-row .rr-name { font-size: 12px; font-weight: 700; display: block; }
.resp-row .rr-preview {
  font-size: 10px;
  color: var(--muted-2);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.resp-row .rr-meta {
  text-align: left;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.resp-row .rr-time { font-size: 9px; color: var(--muted-2); }
.device-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 8.5px;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--bg-2);
  color: var(--muted);
}
.device-tag svg { width: 10px; height: 10px; }

.answer-card { padding: 18px 20px; }
.answer-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.answer-head .rr-avatar { width: 44px; height: 44px; font-size: 13px; }
.answer-head h3 { font-size: 14px; }
.answer-head p { font-size: 10.5px; color: var(--muted-2); }
.answer-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.answer-meta span {
  font-size: 9.5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.answer-meta svg { width: 11px; height: 11px; }
.answer-list { display: flex; flex-direction: column; gap: 13px; max-height: 440px; overflow-y: auto; }
.answer-item label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted-2);
  margin-bottom: 3px;
}
.answer-item .ans-val {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.8;
  background: var(--bg);
  border-radius: 8px;
  padding: 7px 10px;
}
.answer-item .ans-rating { color: #f59e0b; letter-spacing: 2px; }
.answer-empty { text-align: center; padding: 40px 20px; color: var(--muted-2); font-size: 12px; }
.answer-empty .icon { width: 34px; height: 34px; margin: 0 auto 10px; opacity: 0.4; }

.summary-card { margin-bottom: 18px; }
.summary-body { padding: 18px 20px; }
.q-summary { margin-bottom: 18px; }
.q-summary:last-child { margin-bottom: 0; }
.q-summary h4 {
  font-size: 11.5px;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.q-summary h4 .q-type {
  font-size: 8.5px;
  background: var(--bg-2);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 500;
}
.opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.opt-row .opt-label {
  font-size: 10px;
  color: var(--muted);
  width: 105px;
  flex: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opt-row .opt-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-2);
  border-radius: 6px;
  overflow: hidden;
}
.opt-row .opt-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--brand), var(--violet));
}
.opt-row .opt-bar.mint i { background: linear-gradient(90deg, var(--mint), #6ee7b7); }
.opt-row b { font-size: 9.5px; color: var(--muted); width: 32px; text-align: left; flex: none; }
.rating-summary { display: flex; align-items: center; gap: 12px; }
.rating-big {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}
.rating-stars { color: #f59e0b; display: flex; gap: 2px; }
.rating-stars svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.rating-stars svg.dim { fill: var(--line-2); }
.wordcloud { display: flex; flex-wrap: wrap; gap: 7px; }
.wordcloud span {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--brand-soft);
  color: var(--brand);
}
.wordcloud span:nth-child(2n) { background: var(--mint-soft); color: var(--mint); }
.wordcloud span:nth-child(3n) { background: var(--amber-soft); color: var(--amber); }

.export-menu { position: relative; }
.export-menu .dropdown-menu { min-width: 190px; }

/* ---------- templates page ---------- */
.page-hero {
  padding: clamp(38px, 6vw, 70px) 0 clamp(22px, 3vw, 34px);
  background:
    radial-gradient(ellipse 55% 70% at 80% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%),
    radial-gradient(ellipse 45% 60% at 12% 20%, color-mix(in srgb, var(--mint) 8%, transparent), transparent 70%);
  border-bottom: 1px solid var(--line);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero h1 {
  font-size: clamp(26px, 4vw, 42px);
  margin: 14px 0 10px;
  line-height: 1.4;
}
.page-hero p { color: var(--muted); font-size: 14px; line-height: 2; max-width: 560px; margin: 0 auto; }
.page-hero .hero-search {
  max-width: 560px;
  margin: 24px auto 0;
  position: relative;
}
.page-hero .hero-search .icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  width: 19px;
  height: 19px;
}
.page-hero .hero-search input {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  padding: 0 46px 0 16px;
  font-size: 14px;
  outline: 0;
}
.page-hero .hero-search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 11%, transparent);
}
.tpl-filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 26px 0 4px;
}
.tpl-count {
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
  margin-bottom: 22px;
}
.tpl-empty { padding: 70px 20px; text-align: center; }
.tpl-empty .icon { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--muted-2); opacity: 0.5; }
.tpl-empty h3 { font-size: 16px; margin-bottom: 5px; }
.tpl-empty p { font-size: 12px; color: var(--muted); }

/* template preview modal */
.tpl-preview-modal .modal-panel { width: min(1000px, 100%); }
.tpl-preview-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  min-height: 430px;
}
.tpl-preview-art {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.tpl-preview-art img { border-radius: 18px; max-height: 340px; object-fit: cover; box-shadow: var(--shadow-md); }
.tpl-preview-info { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.tpl-preview-info h2 { font-size: 21px; line-height: 1.5; }
.tpl-preview-info > p { font-size: 13px; color: var(--muted); line-height: 2; }
.tpl-preview-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-preview-tags span {
  font-size: 10px;
  background: var(--bg-2);
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 20px;
}
.tpl-stat-row { display: flex; gap: 18px; padding: 14px 0; border-block: 1px solid var(--line); flex-wrap: wrap; }
.tpl-stat-row div b { font-size: 18px; display: block; }
.tpl-stat-row div span { font-size: 10px; color: var(--muted); }
.tpl-preview-fields { display: flex; flex-direction: column; gap: 6px; }
.tpl-preview-fields span {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tpl-preview-fields span::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
}
.tpl-preview-info .btn { margin-top: auto; }

/* ---------- responsive app ---------- */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .resp-layout { grid-template-columns: 1fr; }
  .resp-summary { grid-template-columns: repeat(2, 1fr); }
  .quick-tpl { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .welcome-row { align-items: flex-start; }
  .welcome-actions { width: 100%; }
  .welcome-actions .btn { flex: 1; }
  .onboard-banner { align-items: flex-start; flex-wrap: wrap; }
  .onboard-banner .ob-progress {
    margin-inline-start: 0;
    width: 100%;
    padding-top: 4px;
  }
  .ob-meter { flex: 1; }
  .kpi-grid { gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 24px; }
  .kpi-spark { display: none; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr { display: block; width: 100%; }
  .data-table tr {
    padding: 14px 48px 14px 15px;
    border-bottom: 1px solid var(--line);
    position: relative;
  }
  .data-table td {
    padding: 0;
    border: 0;
    display: none;
  }
  .data-table td:first-child { display: block; }
  .fc-mobile-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
  }
  .fc-mobile-meta span {
    font-size: 9.5px;
    color: var(--muted-2);
    background: var(--bg);
    border-radius: 20px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }
  .fc-mobile-meta .status { background: transparent; padding: 0; }
  .fc-mobile-meta .status::before { display: inline-block; }
  .data-table td.td-actions {
    display: flex;
    position: absolute;
    top: 12px;
    inset-inline-end: 8px;
    margin: 0;
  }
  .data-table .empty-state { display: flex; }
  .data-table tr:has(.empty-state) { padding: 0; }
  .table-search { width: 100%; margin-inline-start: 0; }
  .table-toolbar { gap: 7px; }
  .table-toolbar .filter-tabs { order: 2; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filter-tab { flex: none; }
  .quick-tpl { grid-template-columns: 1fr 1fr; gap: 9px; }
  .resp-summary { gap: 9px; }
  .resp-kpi { padding: 12px; }
  .resp-row .rr-preview { max-width: 170px; }
  .resp-row { padding: 11px 13px; }
  .resp-toolbar .spacer { display: none; }
  .resp-toolbar { gap: 6px; }
  .resp-toolbar .btn, .resp-toolbar .filter-select { flex: 1; }
  .tpl-preview-grid { grid-template-columns: 1fr; }
  .tpl-preview-art { padding: 18px; }
  .tpl-preview-art img { max-height: 200px; }
  .tpl-preview-info { padding: 20px; }
  .page-hero { padding-top: 32px; }
  .page-hero .hero-search input { height: 48px; font-size: 13px; }
}
@media (max-width: 430px) {
  .template-picker { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 21px; }
  .kpi-foot { font-size: 9px; }
  .resp-summary { grid-template-columns: 1fr 1fr; }
}

/* ---------- template library page (v2) ---------- */
.tpl-page-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  align-items: center;
  gap: 28px;
  padding: clamp(24px, 3.6vw, 38px);
  border: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line));
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
  background:
    radial-gradient(ellipse 58% 130% at 94% -10%, color-mix(in srgb, var(--brand) 17%, transparent), transparent 68%),
    radial-gradient(ellipse 46% 100% at 4% 110%, color-mix(in srgb, var(--mint) 13%, transparent), transparent 70%),
    var(--card);
}
.tpl-page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--line-2) 60%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 55% 90% at 92% 10%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 55% 90% at 92% 10%, #000 10%, transparent 70%);
  opacity: 0.65;
}
.tpl-hero-copy { position: relative; z-index: 1; min-width: 0; }
.tpl-hero-copy h2 {
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.5;
  letter-spacing: -0.03em;
  margin: 12px 0 8px;
}
.tpl-hero-copy > p {
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--muted);
  max-width: 500px;
}
.tpl-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 18px 0 14px;
  padding: 5px 6px 5px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}
.tpl-search .icon { width: 18px; height: 18px; color: var(--muted-2); flex: none; margin-inline-start: 4px; }
.tpl-search input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink);
}
.tpl-search .btn { flex: none; min-height: 34px; }
.tpl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  color: var(--muted);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: 0.18s var(--ease);
}
.tpl-chip span {
  font-size: 8.5px;
  min-width: 16px;
  text-align: center;
  padding: 0 5px;
  border-radius: 20px;
  background: var(--bg-2);
  color: var(--muted-2);
}
.tpl-chip:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); color: var(--ink); }
.tpl-chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); box-shadow: 0 6px 16px -8px var(--brand); }
.tpl-chip.active span { background: rgba(255, 255, 255, 0.22); color: #fff; }

.tpl-hero-art { position: relative; height: 236px; z-index: 1; }
.tha-card {
  position: absolute;
  width: 190px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 50px -28px rgba(16, 21, 50, 0.5);
}
.tha-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 11px; }
.tha-card span { display: block; font-size: 9.5px; font-weight: 700; color: var(--ink-2); padding: 6px 5px 3px; }
.tha-1 { inset-inline-start: 4%; top: 0; transform: rotate(-5deg); z-index: 2; }
.tha-2 { inset-inline-end: 0; bottom: 0; transform: rotate(5deg); width: 176px; }
.tha-float {
  position: absolute;
  inset-inline-start: 44%;
  top: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.tha-float .icon { width: 19px; height: 19px; padding: 4px; border-radius: 6px; background: var(--amber-soft); color: var(--amber); }
.tha-float b { display: block; font-size: 11.5px; line-height: 1.3; }
.tha-float small { font-size: 8px; color: var(--muted-2); }

.tpl-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 18px;
}
.tpl-stat { display: flex; align-items: center; gap: 10px; padding: 13px 17px; min-width: 0; }
.tpl-stat + .tpl-stat { border-inline-start: 1px solid var(--line); }
.ts-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--brand-soft);
  color: var(--brand);
}
.ts-icon svg { width: 16px; height: 16px; }
.ts-icon.mint { background: var(--mint-soft); color: var(--mint); }
.ts-icon.amber { background: var(--amber-soft); color: var(--amber); }
.ts-icon.coral { background: var(--coral-soft); color: #e11d48; }
.tpl-stat b { display: block; font-size: 17px; line-height: 1.4; letter-spacing: -0.02em; }
.tpl-stat div span { display: block; font-size: 9px; color: var(--muted-2); white-space: nowrap; }

.tpl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tt-count { font-size: 11px; color: var(--muted-2); }
.tt-count b { font-size: 15px; color: var(--ink); margin-inline-end: 3px; }
.tt-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fav-count {
  font-size: 8.5px;
  min-width: 16px;
  text-align: center;
  padding: 0 5px;
  border-radius: 20px;
  background: var(--bg-2);
  color: var(--muted);
  margin-inline-start: 2px;
}
.btn.is-on { border-color: color-mix(in srgb, var(--coral) 55%, var(--line)); color: #e11d48; background: var(--coral-soft); }

/* card overlays */
.tpl-card { position: relative; min-width: 0; }
.tpl-card .tpl-cover { cursor: pointer; }
.tpl-card .tpl-cover:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: -3px; }
.tpl-card .tpl-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(9, 13, 38, 0.42), transparent 48%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.tpl-card:hover .tpl-cover::after { opacity: 1; }
.tpl-fav {
  position: absolute;
  bottom: 10px;
  inset-inline-start: 10px;
  z-index: 3;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  color: var(--muted);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: 0.2s var(--ease);
}
.tpl-fav svg { width: 14px; height: 14px; }
.tpl-fav:hover { color: #e11d48; transform: scale(1.09); }
.tpl-fav.on { color: #e11d48; background: var(--coral-soft); border-color: color-mix(in srgb, var(--coral) 45%, transparent); }
.tpl-fav.on svg { fill: currentColor; }
.tpl-view {
  position: absolute;
  bottom: 13px;
  inset-inline: 0;
  margin-inline: auto;
  z-index: 2;
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 20px;
  background: rgba(10, 14, 40, 0.66);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(5px);
  transition: 0.22s var(--ease);
  pointer-events: none;
}
.tpl-view svg { width: 11px; height: 11px; }
.tpl-card:hover .tpl-view { opacity: 1; transform: none; }
.tpl-card .tpl-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tpl-card .tpl-title-row h3 { font-size: 14px; line-height: 1.55; min-width: 0; }
.tpl-rate {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  color: var(--mint);
  background: var(--mint-soft);
  border-radius: 20px;
  padding: 2px 6px;
}
.tpl-rate svg { width: 10px; height: 10px; }
.tpl-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tpl-tag { font-size: 8.5px; color: var(--muted); background: var(--bg-2); border-radius: 20px; padding: 2px 7px; white-space: nowrap; }
.tpl-card .tpl-meta { gap: 11px; font-size: 9.5px; }
.tpl-card .tpl-actions .btn { white-space: nowrap; }
.tpl-card.is-fav { border-color: color-mix(in srgb, var(--coral) 28%, var(--line)); }

/* preview modal */
.tpl-modal .modal-panel { width: min(860px, 100%); max-height: 92vh; }
.tpl-modal .modal-body { padding: 0; overflow-y: auto; }
.tpl-preview { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100%; }
.tpl-preview-cover { position: relative; overflow: hidden; background: var(--bg-2); min-height: 100%; }
.tpl-preview-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tpl-preview-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 12, 36, 0.5), transparent 55%);
}
.tpl-preview-badges { position: absolute; top: 13px; inset-inline: 13px; z-index: 1; display: flex; flex-wrap: wrap; gap: 5px; }
.tpp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 8.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--card) 84%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  color: var(--ink-2);
  backdrop-filter: blur(8px);
}
.tpp-badge svg { width: 10px; height: 10px; }
.tpp-badge.pop { background: var(--coral); border-color: transparent; color: #fff; }
.tpp-badge.logic { background: var(--brand); border-color: transparent; color: var(--brand-contrast); }
.tpl-preview-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tpp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tpp-head h2 { font-size: 20px; line-height: 1.5; }
.tpp-tagline { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.tpp-fav { flex: none; border: 1px solid var(--line); color: var(--muted); background: var(--card); }
.tpp-fav.on { color: #e11d48; background: var(--coral-soft); border-color: color-mix(in srgb, var(--coral) 40%, transparent); }
.tpp-fav.on svg { fill: currentColor; }
.tpp-desc { font-size: 11.5px; line-height: 1.9; color: var(--muted); }
.tpp-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.tpp-stats div { padding: 8px 12px; min-width: 0; }
.tpp-stats div + div { border-inline-start: 1px solid var(--line); }
.tpp-stats b { display: block; font-size: 15px; line-height: 1.4; }
.tpp-stats small { font-size: 8px; color: var(--muted-2); white-space: nowrap; }
.tpp-progress { display: flex; align-items: center; gap: 10px; font-size: 9px; color: var(--muted-2); }
.tpp-progress span { flex: none; }
.tpp-bar { flex: 1; height: 6px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.tpp-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--mint), #6ee7b7); }
.tpp-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tpp-sub { font-size: 11.5px; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.tpp-sub svg { width: 14px; height: 14px; color: var(--brand); }
.tpl-field-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; max-height: 210px; overflow-y: auto; padding-inline-end: 2px; }
.tpl-field-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 7px;
}
.tfi-num { flex: none; width: 15px; height: 15px; border-radius: 5px; background: var(--card); display: grid; place-items: center; font-size: 7.5px; color: var(--muted-2); }
.tfi-icon { flex: none; display: flex; color: var(--brand); }
.tfi-icon svg { width: 13px; height: 13px; }
.tfi-label { flex: 1; min-width: 0; font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tfi-req { flex: none; font-size: 11px; font-weight: 800; color: #e11d48; }
.tfi-type { flex: none; font-size: 7.5px; color: var(--muted-2); background: var(--card); border-radius: 20px; padding: 1px 5px; }
.tpp-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 4px; }
.tpp-actions .btn { flex: 1; min-width: 145px; }
.tpp-note { display: flex; align-items: flex-start; gap: 5px; font-size: 8.5px; color: var(--muted-2); line-height: 1.7; border-top: 1px solid var(--line); padding-top: 9px; }
.tpp-note svg { flex: none; width: 11px; height: 11px; margin-top: 2px; }

/* custom CTA */
.tpl-custom {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding: 19px 22px;
  border: 1px dashed color-mix(in srgb, var(--brand) 38%, var(--line));
  border-radius: var(--r-lg);
  background: linear-gradient(120deg, color-mix(in srgb, var(--brand) 8%, transparent), transparent 62%);
}
.tc-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.tc-icon svg { width: 21px; height: 21px; }
.tpl-custom h3 { font-size: 13.5px; }
.tpl-custom p { font-size: 10.5px; color: var(--muted); line-height: 1.8; margin-top: 2px; max-width: 560px; }
.tc-actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tpl-empty { padding: 64px 20px; text-align: center; }
.tpl-empty .te-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  background: var(--bg-2);
  color: var(--muted-2);
}
.tpl-empty .te-icon svg { width: 26px; height: 26px; }
.tpl-empty h3 { font-size: 15px; margin-bottom: 4px; }
.tpl-empty p { font-size: 11px; color: var(--muted); margin-bottom: 13px; }

@media (max-width: 1200px) {
  .tpl-preview { grid-template-columns: 250px minmax(0, 1fr); }
  .tpl-stats { grid-template-columns: 1fr 1fr; }
  .tpl-stat:nth-child(3) { border-inline-start: 0; border-top: 1px solid var(--line); }
  .tpl-stat:nth-child(4) { border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .tpl-page-hero { grid-template-columns: 1fr; padding: 24px; }
  .tpl-hero-art { display: none; }
  .tpl-search { max-width: none; }
  .tpl-hero-copy > p { max-width: none; }
}
@media (max-width: 700px) {
  .tpl-page-hero { padding: 20px 17px; gap: 16px; }
  .tpl-hero-copy h2 { font-size: 24px; }
  .tpl-hero-copy > p { font-size: 11.5px; }
  .tpl-search { margin: 14px 0 12px; }
  .tpl-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .tpl-chips::-webkit-scrollbar { display: none; }
  .tpl-chip { flex: none; }
  .tpl-stats { margin-bottom: 15px; }
  .tpl-stat { padding: 11px 12px; gap: 8px; }
  .tpl-stat b { font-size: 15px; }
  .tpl-stat div span { font-size: 8px; }
  .ts-icon { width: 30px; height: 30px; border-radius: 9px; }
  .ts-icon svg { width: 15px; height: 15px; }
  .tpl-toolbar { align-items: flex-start; }
  .tt-controls { width: 100%; }
  .tt-controls .filter-select { flex: 1; }
  .tpl-modal { padding: 0; }
  .tpl-modal .modal-panel { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .tpl-modal .modal-head { flex: none; }
  .tpl-preview { grid-template-columns: 1fr; }
  .tpl-preview-cover { height: 190px; min-height: 0; }
  .tpl-preview-body { padding: 18px 17px 24px; gap: 11px; }
  .tpl-field-list { grid-template-columns: 1fr; max-height: none; }
  .tpl-custom { padding: 17px; }
  .tc-actions { width: 100%; margin-inline-start: 0; }
  .tc-actions .btn { flex: 1; }
}
@media (max-width: 430px) {
  .tpl-stat { padding: 10px; }
  .tpl-stat div span { white-space: normal; line-height: 1.5; }
  .tpl-stats { grid-template-columns: 1fr 1fr; }
  .tpp-head h2 { font-size: 17px; }
  .tpp-stats div { padding: 7px 9px; }
  .tpp-stats b { font-size: 13.5px; }
}

/* =========================================================
   Attachments + ZIP preview (responses)
   ========================================================= */
body.modal-open { overflow: hidden; }
.attachment-modal { z-index: 240; }
.attachment-modal .modal-panel { width: min(840px, 100%); }
.attachment-modal .modal-head { align-items: flex-start; }
.am-head-icon {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--mint-soft);
  color: var(--mint);
}
.am-head-icon .icon { width: 21px; height: 21px; }
.am-head-copy { flex: 1; min-width: 0; }
.am-head-copy h3 { margin-bottom: 3px; }
.am-head-copy p { font-size: 10.5px; color: var(--muted-2); }
.attachment-modal .modal-body { padding: 20px 22px 22px; }
.attachment-modal .modal-foot { flex-wrap: wrap; }
.am-foot-note { font-size: 9.5px; color: var(--muted-2); }
#attachmentDownloadBtn.is-loading .icon { animation: am-spin 0.9s linear infinite; }
@keyframes am-spin { to { transform: rotate(360deg); } }

.am-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.am-stat {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  min-width: 0;
}
.am-stat-icon {
  width: 31px;
  height: 31px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--muted);
}
.am-stat-icon .icon { width: 15px; height: 15px; }
.am-stat.mint .am-stat-icon { background: var(--mint-soft); color: var(--mint); }
.am-stat.amber .am-stat-icon { background: var(--amber-soft); color: #b45309; }
.am-stat.coral .am-stat-icon { background: var(--coral-soft); color: var(--coral); }
.am-stat b { display: block; font-size: 15px; line-height: 1.15; }
.am-stat small { display: block; font-size: 8.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.am-notice,
.am-warning {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.8;
  margin-bottom: 13px;
}
.am-notice { background: var(--mint-soft); color: color-mix(in srgb, var(--mint) 65%, var(--ink)); }
.am-warning { background: var(--amber-soft); color: color-mix(in srgb, #b45309 80%, var(--ink)); margin-top: 13px; }
.am-notice .icon,
.am-warning .icon { width: 14px; height: 14px; flex: none; margin-top: 2px; }
[data-theme="dark"] .am-notice { color: #b7f7e3; }
[data-theme="dark"] .am-warning { color: #fde2b0; }

.am-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 15px 0 8px;
}
.am-section-head h4 { font-size: 12px; }
.am-section-head span { font-size: 9px; color: var(--muted-2); }

.am-tree {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  overflow: hidden;
}
.am-tree-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-bottom: 1px dashed color-mix(in srgb, var(--line) 80%, transparent);
  min-width: 0;
}
.am-tree-row.root { background: var(--card-2); }
.am-tree-row.meta { padding-inline-start: 28px; }
.am-tree-row.folder { padding-inline-start: 28px; background: color-mix(in srgb, var(--mint-soft) 40%, var(--card)); }
.am-tree-icon {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--bg);
  color: var(--muted);
}
.am-tree-icon .icon { width: 13px; height: 13px; }
.am-tree-row.root .am-tree-icon { background: var(--mint-soft); color: var(--mint); }
.am-tree-body { flex: 1; min-width: 0; }
.am-tree-body b { display: block; font-size: 10.5px; word-break: break-all; }
.am-tree-body small { display: block; font-size: 8.5px; color: var(--muted-2); margin-top: 1px; }
.am-tag {
  flex: none;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--mint-soft);
  color: color-mix(in srgb, var(--mint) 75%, #054d38);
}
.am-tag.meta { background: var(--bg); color: var(--muted-2); }
.am-tag.demo { background: var(--amber-soft); color: #b45309; }
[data-theme="dark"] .am-tag { color: var(--mint); }
[data-theme="dark"] .am-tag.demo { color: #fbbf24; }

.am-groups { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 7px; }
.am-group { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.am-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
}
.am-gfolder {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--muted-2);
}
.am-gfolder .icon { width: 12px; height: 12px; }
.am-group-head > div { flex: 1; min-width: 0; }
.am-group-head b { display: block; font-size: 10px; }
.am-group-head small { display: block; font-size: 8px; color: var(--muted-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-group-files { padding: 4px 6px 6px 22px; display: flex; flex-direction: column; gap: 3px; }
.am-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 7px;
  min-width: 0;
}
.am-file:hover { background: var(--bg); }
.am-file.is-demo { opacity: 0.88; }
.am-file-icon {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--muted);
}
.am-file-icon .icon { width: 13px; height: 13px; }
.am-file-body { flex: 1; min-width: 0; }
.am-file-body b { display: block; font-size: 9px; color: var(--muted); }
.am-file-body small { display: block; font-size: 10px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-file-size { flex: none; font-size: 8.5px; color: var(--muted-2); }
.am-file-btn {
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.am-file-btn:hover { color: var(--mint); border-color: var(--mint); }
.am-file-btn .icon { width: 12px; height: 12px; }

.am-download-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 9.5px;
  color: var(--muted-2);
}
.am-download-hint .icon { width: 13px; height: 13px; }
.am-empty { text-align: center; padding: 34px 20px; }
.am-empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--mint-soft);
  color: var(--mint);
}
.am-empty-icon .icon { width: 27px; height: 27px; }
.am-empty h4 { font-size: 14px; margin-bottom: 7px; }
.am-empty p { max-width: 460px; margin: 0 auto 16px; font-size: 11px; line-height: 2; color: var(--muted-2); }

.answer-attachments {
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--mint) 22%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--mint-soft) 30%, var(--card));
}
.aa-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.aa-title { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; }
.aa-title .icon { width: 13px; height: 13px; color: var(--mint); }
.aa-meta { font-size: 9px; color: var(--muted-2); }
.aa-head .btn { margin-inline-start: auto; }
.aa-files { display: flex; flex-wrap: wrap; gap: 5px; }
.aa-file {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.aa-file:hover { border-color: var(--mint); }
.aa-file.is-demo { cursor: default; background: var(--card-2); }
.aa-file-icon { width: 19px; height: 19px; flex: none; border-radius: 5px; display: grid; place-items: center; background: var(--mint-soft); color: var(--mint); }
.aa-file-icon .icon { width: 11px; height: 11px; }
.aa-file-body { min-width: 0; display: flex; flex-direction: column; }
.aa-file-body b { font-size: 8.5px; color: var(--muted-2); font-weight: 600; }
.aa-file-body small { font-size: 9.5px; font-weight: 700; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-file-size { font-size: 8px; color: var(--muted-2); }
.aa-note { display: flex; align-items: flex-start; gap: 5px; margin-top: 7px; font-size: 8.5px; line-height: 1.7; color: var(--muted-2); }
.aa-note .icon { width: 11px; height: 11px; flex: none; margin-top: 2px; }

@media (max-width: 700px) {
  .attachment-modal { padding: 0; }
  .attachment-modal .modal-panel { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .attachment-modal .modal-head { padding: 15px 16px; border-radius: 0; }
  .attachment-modal .modal-body { padding: 14px 15px 18px; }
  .attachment-modal .modal-foot { padding: 12px 15px; border-radius: 0; }
  .am-summary { grid-template-columns: 1fr 1fr; }
  .am-stat small { font-size: 8px; }
  .am-tree-row { padding: 8px 9px; }
  .am-tree-row.meta,
  .am-tree-row.folder { padding-inline-start: 20px; }
  .am-group-files { padding-inline-start: 10px; }
  .aa-file-body small { max-width: 130px; }
  .aa-head .btn { width: 100%; margin-inline-start: 0; justify-content: center; }
}
@media (max-width: 430px) {
  .am-summary { grid-template-columns: 1fr 1fr; gap: 6px; }
  .am-stat { padding: 8px; }
  .am-stat b { font-size: 13px; }
  .am-stat small { white-space: normal; }
  .attachment-modal .modal-foot .am-foot-note { width: 100%; order: 3; }
}

/* =========================================================
   Response tools — saved views, CSV import, contact exports
   ========================================================= */
.resp-views-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
}
.rv-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted-2);
  padding-inline: 3px;
}
.rv-label .icon {
  width: 13px;
  height: 13px;
}
.rv-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.rv-empty {
  font-size: 10px;
  color: var(--muted-2);
  line-height: 1.7;
}
.rv-chip {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2, var(--line));
  max-width: 100%;
}
.rv-chip.active {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  background: var(--brand-soft);
}
.rv-chip-main,
.rv-chip-del {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.rv-chip-main {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.rv-chip-main .icon {
  width: 12px;
  height: 12px;
  flex: none;
}
.rv-chip-main:hover {
  color: var(--brand);
}
.rv-chip-del {
  padding: 0 7px;
  border-inline-start: 1px solid var(--line);
  font-size: 14px;
  line-height: 1;
  color: var(--muted-2);
}
.rv-chip-del:hover {
  color: #dc2626;
  background: #fef2f2;
}
[data-theme="dark"] .rv-chip-del:hover {
  background: #3a191b;
  color: #fca5a5;
}
.rv-spacer {
  flex: 1;
}

.view-save-summary {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}
.modal-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.8;
}
.modal-note .icon {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 2px;
  color: var(--brand);
}
.modal-note.danger {
  background: #fff7ed;
  color: #9a3412;
}
.modal-note.danger .icon {
  color: #ea580c;
}
[data-theme="dark"] .modal-note.danger {
  background: #342015;
  color: #fdba74;
}

.import-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.import-stat {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2, var(--line));
  text-align: center;
}
.import-stat b {
  display: block;
  font-size: 19px;
  color: var(--brand);
}
.import-stat span {
  display: block;
  font-size: 9px;
  line-height: 1.6;
  color: var(--muted-2);
  margin-top: 2px;
}
.import-detail {
  margin-top: 9px;
  font-size: 10px;
  line-height: 1.8;
  color: var(--muted);
  word-break: break-word;
}
.import-detail b {
  color: var(--text);
}

@media (max-width: 760px) {
  .resp-views-bar {
    align-items: stretch;
  }
  .rv-label {
    width: 100%;
  }
  .rv-chips {
    flex-basis: 100%;
    order: 2;
  }
  .rv-spacer {
    display: none;
  }
  .resp-views-bar > .btn {
    flex: 1;
  }
  .import-summary-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 460px) {
  .rv-chip-main {
    max-width: 145px;
  }
}
