/* ==========================================================================
   پرسش‌نامه‌ساز سازمانی — Swiss / Minimal design system (RTL)
   Tokens first, then shell, then components. No external assets.
   ========================================================================== */

@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bg: #f2f7f6;
  --surface: #ffffff;
  --surface-2: #f7fbfa;
  --surface-3: #eef5f4;
  --ink: #10201f;
  --ink-2: #465b59;
  --ink-3: #5f7371;
  --line: #dde9e7;
  --line-strong: #c6d8d5;
  --field-line: #7d938f;

  --primary: #0f766e;
  --primary-strong: #0b5c55;
  --primary-soft: #e2f3f0;
  --accent: #b45309;
  --accent-soft: #fdf1e3;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #067647;
  --ok-soft: #e6f5ec;
  --info: #175cd3;
  --info-soft: #e8f0fd;
  --warn: #b54708;
  --warn-soft: #fdf1e3;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(16, 32, 31, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 32, 31, 0.07), 0 1px 2px rgba(16, 32, 31, 0.04);
  --shadow-md: 0 8px 24px -12px rgba(16, 32, 31, 0.25);
  --ring: 0 0 0 3px rgba(15, 118, 110, 0.18);
  --sidebar-w: 264px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --speed: 180ms;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 0.75em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--speed) var(--ease);
}
a:hover {
  color: var(--primary-strong);
}

img {
  max-width: 100%;
}

svg {
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

/* ------------------------------------------------------------------ shell */

.app-main {
  min-width: 0;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 32px 56px;
}

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 16px;
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
  overflow-y: auto;
}

.app-main {
  margin-inline-start: var(--sidebar-w);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}
.brand:hover {
  color: var(--ink);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(150deg, var(--primary) 0%, #0b5c55 100%);
  box-shadow: var(--shadow-xs);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.brand-text small {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  padding: 14px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.nav a svg {
  color: var(--ink-3);
  transition: color var(--speed) var(--ease);
}
.nav a:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.nav a:hover svg {
  color: var(--primary);
}
.nav a.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}
.nav a.is-active svg {
  color: var(--primary);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 10px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 13px;
}
.who-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.who-role {
  font-size: 11px;
  color: var(--ink-3);
}

.mobile-bar {
  display: none;
}

.nav-toggle {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------ page heading */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .h1 {
  font-size: 25px;
  font-weight: 700;
}
.page-head p {
  margin: 4px 0 0;
  font-size: 13.5px;
}

.h1 {
  font-size: 25px;
  font-weight: 700;
}
.h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}
.section-title {
  margin: 34px 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.back:hover {
  color: var(--primary);
}

.muted {
  color: var(--ink-2);
}
.small {
  font-size: 12.5px;
}
.strong {
  font-weight: 600;
  color: var(--ink);
}
.center {
  text-align: center;
}
.spacer {
  flex: 1;
}

/* ----------------------------------------------------------------- layout */

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.row > .grow {
  flex: 1 1 240px;
}
.grow {
  flex: 1;
}
.space-between {
  justify-content: space-between;
  align-items: center;
}
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.align-end {
  display: flex;
  align-items: flex-end;
}
.inline {
  display: inline-flex;
  margin: 0;
}
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}
.inline-form input {
  flex: 1 1 220px;
  width: auto;
  min-width: 180px;
}
.inline-form .btn {
  flex: none;
}

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}
.card + .card,
.card + .table-wrap,
.table-wrap + .card,
.section-title + .card {
  margin-top: 16px;
}
.card > .h2:first-child {
  margin-top: 0;
}

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-2);
}
.empty p:first-child {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
}

/* ----------------------------------------------------------------- button */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease),
    color var(--speed) var(--ease), transform var(--speed) var(--ease),
    box-shadow var(--speed) var(--ease);
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--surface-3);
  border-color: transparent;
  color: var(--ink);
}

.btn-danger {
  background: var(--surface);
  border-color: #f1c7c3;
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: #e9b3ae;
  color: var(--danger);
}

.btn-sm {
  min-height: 32px;
  padding: 4px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-block {
  display: flex;
  width: 100%;
  min-height: 44px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.row-actions form {
  margin: 0;
}

/* ------------------------------------------------------------------ forms */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
    background var(--speed) var(--ease);
}
textarea {
  min-height: 84px;
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: var(--ink-3);
}
input:hover,
select:hover,
textarea:hover {
  border-color: #6b817d;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: var(--surface);
}
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-3);
  color: var(--ink-3);
  cursor: not-allowed;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235f7371' stroke-width='1.8'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
  padding-left: 30px;
}

input[type="color"] {
  padding: 4px;
  min-height: 42px;
}
input[type="datetime-local"],
input[dir="ltr"] {
  font-variant-numeric: tabular-nums;
}

.checkbox {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-2);
  cursor: pointer;
  padding: 4px 0;
}
.checkbox input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}
.compact {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12.5px;
  border-radius: 8px;
  width: auto;
}
select.compact {
  padding-left: 26px;
}

.form-hint {
  font-size: 12px;
  color: var(--ink-3);
}

/* ------------------------------------------------------------------ table */

.table-wrap {
  overflow-x: auto;
  padding: 0;
  border-radius: var(--radius-lg);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 720px;
}
.table th {
  padding: 12px 16px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr {
  transition: background var(--speed) var(--ease);
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table .row-actions {
  justify-content: flex-start;
}
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.matrix-table th,
.matrix-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: center;
}

/* ----------------------------------------------------------------- badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.9;
  white-space: nowrap;
}
.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge-info {
  background: var(--info-soft);
  color: var(--info);
}

/* ----------------------------------------------------------------- alerts */

.alert {
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #f2d5ac;
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: #713f12;
  font-size: 13px;
}
.alert-ok {
  border-color: #bfe3cd;
  border-inline-start-color: var(--ok);
  background: var(--ok-soft);
  color: #05603a;
}
.error-list {
  margin: 0 0 14px;
  padding: 12px 16px;
  list-style: none;
  border: 1px solid #f3c6c1;
  border-inline-start: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: #912018;
  font-size: 13px;
}
.error-list li + li {
  margin-top: 4px;
}

/* ------------------------------------------------------------------ stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 20px 16px;
  box-shadow: var(--shadow-xs);
}
.stat::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  flex: none;
}
.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.stat-value {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat .muted {
  display: block;
  margin-top: 2px;
}
.stat-note {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.stat-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-strong);
  text-decoration: none;
}
.stat-link:hover {
  text-decoration: underline;
}
.stats-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 13px;
  color: var(--ink-2);
}
.stats-inline b {
  color: var(--ink);
}

/* ------------------------------------------------------- share / technical */

.share-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.share-link {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  direction: ltr;
  text-align: left;
  word-break: break-all;
}
.code-block,
.token {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  direction: ltr;
  text-align: left;
  word-break: break-all;
}
.qr-img {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 12px;
}
.chip-x {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.chip-x:hover {
  color: var(--danger);
}
.column-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 14px;
}

/* --------------------------------------------------------------- settings */

.settings-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 16px;
  background: var(--surface-2);
}
.settings-group[open] {
  padding-bottom: 16px;
  background: var(--surface);
}
.settings-group > summary {
  cursor: pointer;
  padding: 13px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.settings-group > summary::-webkit-details-marker {
  display: none;
}
.settings-group > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-inline-end: 1.6px solid var(--ink-3);
  border-bottom: 1.6px solid var(--ink-3);
  transform: rotate(45deg);
  transition: transform var(--speed) var(--ease);
}
.settings-group[open] > summary::after {
  transform: rotate(-135deg);
}
.settings-group > .row + .row,
.settings-group > label + .row {
  margin-top: 12px;
}

/* ----------------------------------------------------------------- builder */

.question {
  padding: 18px 20px;
}
.q-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.question .stack {
  gap: 10px;
}
.question .h2 {
  margin-bottom: 0;
}
.logic-row {
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.add-question {
  border-style: dashed;
  background: var(--surface-2);
}

/* ------------------------------------------------------------------ auth */

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 420px at 85% -10%, #dff1ee 0%, rgba(223, 241, 238, 0) 60%),
    radial-gradient(700px 380px at 0% 110%, #e8f2f7 0%, rgba(232, 242, 247, 0) 60%),
    var(--bg);
}
.auth-shell {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0;
  width: 100%;
  max-width: 900px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.auth-aside {
  padding: 38px 36px;
  background:
    linear-gradient(155deg, #0b3f3b 0%, #0f5d56 55%, #0f766e 100%);
  color: #e7f5f2;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-aside .brand-mark {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  color: #fff;
}
.auth-aside h1 {
  font-size: 23px;
  color: #fff;
  margin-top: 8px;
}
.auth-aside p {
  font-size: 13.5px;
  color: #c9e6e0;
  max-width: 34ch;
}
.auth-points {
  list-style: none;
  margin: auto 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-points li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #d6ece7;
}
.auth-points svg {
  color: #7fd8c9;
}
.auth-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 38px 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: center;
}
.auth-card .h1 {
  font-size: 21px;
}
.auth-card p {
  font-size: 13px;
}
.auth-card .btn-block {
  margin-top: 4px;
}

/* ---------------------------------------------------------------- public */

.public-body {
  background:
    radial-gradient(760px 340px at 100% 0%, rgba(15, 118, 110, 0.07), transparent 60%),
    var(--bg);
  min-height: 100dvh;
}
.public-wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 20px 56px;
}
.public-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.public-card {
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 30px;
}
.public-card.center {
  max-width: 460px;
  margin: 0 auto;
}
.footer-note {
  margin-top: 26px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-3);
}
.public-body .h1 {
  font-size: 21px;
  margin-bottom: 6px;
}
.public-body label {
  font-size: 13px;
}
.public-body input,
.public-body select,
.public-body textarea {
  min-height: 46px;
  font-size: 15px;
}
.public-body .btn {
  min-height: 46px;
  font-size: 14.5px;
}

.gate-card .btn-block {
  margin-top: 18px;
}
.gate-label {
  text-align: right;
}

.otp-label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  text-align: right;
}

.otp-boxes {
  display: flex;
  direction: ltr;
  justify-content: center;
  gap: 9px;
  margin: 8px 0 2px;
}
.otp-box {
  flex: 1 1 0;
  min-width: 0;
  max-width: 56px;
  height: 58px;
  padding: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.otp-box.is-filled {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.otp-boxes + .btn-block {
  margin-top: 16px;
}

.q-block {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.q-block:last-of-type {
  border-bottom: 0;
}
.q-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.q-help {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.jalali-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}
.jalali-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.answers {
  margin: 0;
}
.answers dt {
  margin-top: 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.answers dt:first-child {
  margin-top: 0;
}
.answers dd {
  margin: 3px 0 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.7;
}
.answers dd:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.public-cover {
  margin: 0 0 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.public-cover img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}
.draft-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13px;
}
.draft-note[hidden] {
  display: none;
}
video.q-media,
.q-media {
  width: 100%;
  max-height: 420px;
  border-radius: 14px;
  background: #000;
}
.option-media {
  align-items: center;
}
.option-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
}
.cover-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.cover-preview {
  display: block;
  max-width: 360px;
  max-height: 190px;
  width: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.cover-actions {
  min-width: 260px;
  flex: 1;
}
.option-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.option-thumbs figure {
  margin: 0;
  text-align: center;
}
.option-thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 14px;
  align-items: end;
}
.form-grid label {
  min-width: 0;
}
.form-grid-actions {
  display: flex;
  align-items: flex-end;
  grid-column: 1 / -1;
}
.form-grid-actions .btn {
  min-width: 168px;
}

.skip-link {
  position: fixed;
  top: 10px;
  inset-inline-start: 12px;
  z-index: 60;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--speed) var(--ease);
}
.skip-link:focus-visible {
  transform: translateY(0);
}

.media-field {
  margin: 4px 0 2px;
}

.media-preview {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.media-preview img {
  max-height: 150px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 4px;
}

.q-media {
  margin: 8px 0 12px;
  border-radius: var(--radius);
  overflow: hidden;
}
.req {
  color: var(--danger);
  margin-inline-start: 2px;
}
.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.options-inline {
  flex-direction: row;
  flex-wrap: wrap;
}
.option {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.option:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}
.option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  font-weight: 500;
}
.option input {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  accent-color: var(--brand, var(--primary));
  cursor: pointer;
}
.option-chip {
  border-radius: 999px;
}
.ranking {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ranking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.rank-no {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand, var(--primary));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.rank-label {
  flex: 1;
  font-size: 14px;
}
.rank-actions {
  display: flex;
  gap: 4px;
}
.rank-actions button {
  min-height: 28px;
  padding: 2px 9px;
  font-size: 12px;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.slider {
  flex: 1;
  accent-color: var(--brand, var(--primary));
}
.slider-value {
  min-width: 42px;
  text-align: center;
  font-weight: 600;
  color: var(--brand, var(--primary));
}
.signature-box {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 6px;
}
.signature-canvas {
  display: block;
  width: 100%;
  height: 160px;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stepper-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.stepper-nav + .btn-block {
  margin-top: 2px;
}
.step {
  margin-bottom: 14px;
}
.step-hidden {
  display: none;
}
.score-box {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-strong);
  text-align: center;
}
.score-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

/* ---------------------------------------------------------------- charts */

.chart-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.chart-row {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.chart-row > .chart-box {
  flex: 0 0 auto;
}
.chart-row > .chart-bars {
  flex: 1 1 260px;
  min-width: 0;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 3fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.bar-label {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand, var(--primary));
  transition: width 320ms var(--ease);
}
.bar-value {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.donut {
  display: block;
  margin-inline: auto;
}
.option.is-full {
  opacity: 0.5;
}
.option.is-full span {
  text-decoration: line-through;
}
.quota-note {
  margin-inline-start: auto;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}
.quota-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.report-chart .bar-row {
  grid-template-columns: minmax(120px, 1.3fr) 3fr minmax(84px, auto);
  gap: 14px;
  padding: 3px 0;
}
.report-chart .bar-row:has(.bar-fill[style="width: 0.0%"]) .bar-label {
  color: var(--ink-3);
}
.chart-figure {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.5;
  white-space: nowrap;
}
.chart-figure .muted {
  font-weight: 400;
}
.text-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.text-answers li,
.text-answers p {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin: 0;
}

/* --------------------------------------------------------------- comments */

.comment {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
}
.answers {
  font-size: 13.5px;
}
.preview-img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 232px;
  }
  .container {
    padding: 24px 20px 48px;
  }
  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
  /* One card only: the marketing panel must not stack above the form. */
  .auth-aside {
    display: none;
  }
  .auth-card {
    padding: 32px 24px;
  }
  .auth-card .otp-box {
    height: 52px;
    font-size: 20px;
  }
}

@media (max-width: 860px) {
  .sidebar {
    inset-inline-start: 0;
    width: min(84vw, 300px);
    transform: translateX(100%);
    transition: transform 220ms var(--ease);
    box-shadow: var(--shadow-md);
  }
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  .nav-toggle:checked ~ .sidebar {
    transform: translateX(0);
  }
  .app-main {
    margin-inline-start: 0;
  }
  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .mobile-bar .brand {
    padding: 0;
    font-size: 14px;
  }
  .nav-burger {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink-2);
    cursor: pointer;
    background: var(--surface);
  }
  .nav-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16, 32, 31, 0.35);
    cursor: pointer;
  }
  .nav-toggle:checked ~ .nav-scrim {
    display: block;
  }
  .container {
    padding: 20px 16px 44px;
  }
  .page-head {
    align-items: flex-start;
  }
  .page-head .h1 {
    font-size: 21px;
  }
  .card {
    padding: 18px;
    border-radius: var(--radius);
  }
  .public-wrap {
    padding: 22px 14px 40px;
  }
  .public-card {
    padding: 20px;
    border-radius: 16px;
  }
  .row {
    gap: 10px;
  }
  .row > label,
  .row > .grow {
    flex: 1 1 100%;
  }
  .inline-form {
    width: 100%;
  }
  .inline-form input {
    flex: 1;
    min-width: 0;
  }
  .chart-row,
  .bar-row {
    grid-template-columns: minmax(70px, 1fr) 2fr auto;
  }
}

@media (pointer: coarse) {
  /* Touch devices: every control reaches the 44px target. */
  .btn,
  .btn-sm,
  .nav a {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .sidebar,
  .mobile-bar,
  .row-actions,
  .btn {
    display: none !important;
  }
  .app-main {
    margin: 0;
  }
  .card,
  .table-wrap {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  body {
    background: #fff;
  }
}
