
:root {
  color-scheme: light;
  --bg: #f8f8fb;
  --panel: #ffffff;
  --panel-soft: #f5f4fa;
  --text: #17162f;
  --muted: #777487;
  --muted-2: #9a97a9;
  --line: #ecebf2;
  --brand: #27206f;
  --brand-2: #4337a0;
  --brand-soft: #f0eefb;
  --success: #1d7a50;
  --danger: #b14343;
  --shadow: 0 12px 30px rgba(34, 29, 83, 0.06);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .04em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border: 1px solid #c9c4e5;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  letter-spacing: 0;
  background: radial-gradient(circle at 35% 35%, #fff 0 18%, #ede9fb 50%, #d8d1f5 100%);
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 650;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(39,32,111,.16); }
.btn-secondary { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-danger { background: #fff3f3; color: var(--danger); border: 1px solid #f3d6d6; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Public forms */
.form-page { min-height: 100vh; padding: 28px 20px 44px; }
.form-shell { width: min(840px, 100%); margin: 0 auto; }
.form-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.language-pill { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.form-card { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.form-hero { padding: 34px 38px 24px; border-bottom: 1px solid var(--line); }
.form-hero h1 { margin: 0 0 10px; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.035em; font-weight: 720; }
.form-hero p { margin: 0; max-width: 660px; color: var(--muted); font-size: 16px; }
.progress-wrap { padding: 20px 38px 0; }
.progress-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.progress-track { height: 6px; background: #efedf7; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 25%; background: var(--brand); border-radius: inherit; transition: width .25s ease; }
.form-body { padding: 28px 38px 38px; }
.form-step[hidden] { display: none; }
.step-heading { margin-bottom: 26px; }
.step-heading h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.step-heading p { margin: 0; color: var(--muted); }
.question { margin: 0 0 26px; padding: 0; border: 0; }
.question:last-child { margin-bottom: 0; }
.question-label, .question legend { display: block; width: 100%; margin: 0 0 9px; font-weight: 650; color: var(--text); }
.question-help { display: block; margin: -3px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.required-dot { color: var(--brand-2); margin-left: 3px; }
.control {
  width: 100%; min-height: 48px; border: 1px solid #dedce8; border-radius: 12px; padding: 11px 13px;
  background: #fff; color: var(--text); outline: none; transition: border .16s ease, box-shadow .16s ease;
}
.control:focus { border-color: #a29bd2; box-shadow: 0 0 0 4px rgba(67,55,160,.09); }
textarea.control { min-height: 126px; resize: vertical; }
.options { display: grid; gap: 9px; }
.option-card {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border: 1px solid #e3e1eb;
  border-radius: 12px; background: #fff; cursor: pointer; transition: border .16s ease, background .16s ease, transform .16s ease;
}
.option-card:hover { border-color: #c8c3e3; transform: translateY(-1px); }
.option-card:has(input:checked) { border-color: #8d85c3; background: var(--brand-soft); }
.option-card input { margin: 3px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.option-card span { line-height: 1.4; }
.property-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.property-options .option-card { min-height: 72px; align-items: center; }
.consent-box { background: #f8f7fc; border: 1px solid #e2dfef; border-radius: 14px; padding: 15px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-actions .btn-primary { margin-left: auto; }
.form-error { margin: 18px 0 0; color: var(--danger); background: #fff5f5; border: 1px solid #f2d8d8; border-radius: 12px; padding: 11px 13px; display: none; }
.form-error.visible { display: block; }
.form-success { text-align: center; padding: 70px 32px 78px; }
.success-icon { width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%; background: #eef8f2; color: var(--success); display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.form-success h2 { margin: 0 0 10px; font-size: 30px; letter-spacing: -.025em; }
.form-success p { margin: 0 auto; max-width: 560px; color: var(--muted); }
.form-footer { padding: 18px 4px 0; text-align: center; color: var(--muted-2); font-size: 12px; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

/* Admin */
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: #fff; padding: 28px 16px 20px; display: flex; flex-direction: column; }
.sidebar .brand { padding: 0 8px; margin-bottom: 36px; }
.nav-list { display: grid; gap: 6px; }
.nav-btn { width: 100%; border: 0; background: transparent; color: #676377; border-radius: 12px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; text-align: left; font-weight: 600; }
.nav-btn:hover, .nav-btn.active { background: var(--brand-soft); color: var(--brand); }
.nav-icon { width: 20px; text-align: center; opacity: .8; }
.sidebar-note { margin-top: auto; background: #f7f6fb; border-radius: 14px; padding: 14px; color: var(--muted); font-size: 12px; }
.sidebar-note strong { display: block; color: var(--text); margin: 5px 0 3px; }
.admin-main { min-width: 0; padding: 30px 36px 46px; }
.admin-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.admin-kicker { color: var(--muted); font-size: 13px; margin-bottom: 3px; }
.admin-header h1 { margin: 0; font-size: clamp(30px, 3vw, 42px); line-height: 1.1; letter-spacing: -.035em; }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.view[hidden] { display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 19px; min-height: 116px; }
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stat-value { font-size: 30px; line-height: 1; letter-spacing: -.025em; }
.stat-hint { color: var(--muted-2); font-size: 11px; margin-top: 8px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-bottom: 16px; }
.panel-header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-header h2 { margin: 0; font-size: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-control { min-height: 38px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 10px; color: var(--text); outline: none; }
.search { min-width: 240px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { padding: 12px 16px; text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid #f0eff4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover { background: #faf9fd; }
.primary-cell { font-weight: 650; }
.secondary-line { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 650; background: var(--brand-soft); color: var(--brand); }
.badge.en { background: #f3f0e5; color: #665a22; }
.badge.sent { background: #edf8f2; color: #317657; }
.badge.failed { background: #fff0f0; color: #a64a4a; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.detail-header h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.025em; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.detail-item { padding: 17px 22px; border-bottom: 1px solid var(--line); }
.detail-item:nth-child(odd) { border-right: 1px solid var(--line); }
.detail-label { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.detail-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-section-title { grid-column: 1 / -1; padding: 18px 22px 10px; font-weight: 700; background: #fbfafd; border-bottom: 1px solid var(--line); }
.property-form { display: grid; grid-template-columns: 150px minmax(240px,1fr) auto; gap: 9px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.property-row-actions { display: flex; gap: 8px; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.export-card { border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.export-card h3 { margin: 0 0 7px; }
.export-card p { margin: 0 0 16px; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 12px; background: #f5f3fb; color: #595374; font-size: 13px; }
.admin-toast { position: fixed; right: 22px; bottom: 22px; background: #1f1d34; color: #fff; padding: 11px 14px; border-radius: 11px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; z-index: 99; }
.admin-toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 74px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar .brand span:not(.brand-mark), .nav-btn span:not(.nav-icon), .sidebar-note { display: none; }
  .sidebar .brand { padding: 0; justify-content: center; }
  .nav-btn { justify-content: center; padding-inline: 0; }
  .admin-main { padding: 26px 22px 40px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .form-page { padding: 16px 12px 30px; }
  .form-topbar { margin: 5px 5px 16px; }
  .form-card { border-radius: 18px; }
  .form-hero { padding: 26px 22px 20px; }
  .form-hero h1 { font-size: 30px; }
  .progress-wrap { padding: 17px 22px 0; }
  .form-body { padding: 24px 22px 28px; }
  .property-options { grid-template-columns: 1fr; }
  .form-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.94); margin-left: -22px; margin-right: -22px; padding: 14px 22px 0; backdrop-filter: blur(8px); }
  .admin-shell { display: block; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; flex-direction: row; align-items: center; gap: 12px; }
  .sidebar .brand { margin: 0 auto 0 0; }
  .sidebar .brand span:not(.brand-mark) { display: inline; }
  .nav-list { display: flex; gap: 4px; }
  .nav-btn { width: auto; padding: 9px; }
  .admin-main { padding: 22px 14px 34px; }
  .admin-header { display: block; }
  .toolbar { justify-content: flex-start; margin-top: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filters { width: 100%; }
  .filter-control, .search { width: 100%; min-width: 0; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item:nth-child(odd) { border-right: 0; }
  .property-form { grid-template-columns: 1fr; }
  .export-grid { grid-template-columns: 1fr; }
}
