.auth-body,
.dashboard-body {
  min-height: 100vh;
  height: auto;
  overflow: auto;
}

.dashboard-body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-body .app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: 0 0 auto;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
}

.auth-card,
.dashboard-panel {
  width: 100%;
  max-width: 920px;
  background-color: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.auth-card {
  max-width: 410px;
  padding: 38px;
  box-shadow: 0 28px 70px -28px rgba(0, 102, 255, 0.22);
}

.auth-brand-min,
.top-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-brand-min {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 30px;
}

.auth-heading {
  margin-bottom: 28px;
  text-align: center;
  font-size: 1.8rem;
  line-height: 1.2;
  color: var(--text-main);
  letter-spacing: 0;
}

.auth-switch,
.empty-state p,
.survey-row p,
.survey-meta {
  color: var(--text-muted);
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.auth-form .btn {
  width: 100%;
  margin-top: 4px;
  min-height: 54px;
}

.auth-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-switch {
  margin-top: 24px;
  text-align: center;
  font-size: 0.9rem;
}

.auth-switch a {
  margin-left: 6px;
}

.auth-switch a,
.link-btn {
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
}

.dashboard-shell {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 30px 24px 48px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.dashboard-panel {
  padding: 34px;
}

.link-btn {
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--primary-light);
}

.link-btn.muted {
  color: var(--text-muted);
  background: #f1f5f9;
}

.survey-list {
  display: grid;
  gap: 12px;
}

.dashboard-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 6px 0 20px;
  padding: 14px;
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 20px;
  background: linear-gradient(135deg, #f8fbff, #ffffff);
}

.toolbar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 50px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: #fff;
  color: var(--text-muted);
  box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.28);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.toolbar-search:focus-within {
  border-color: rgba(0, 102, 255, 0.45);
  background: #ffffff;
  box-shadow: 0 16px 30px -22px rgba(0, 102, 255, 0.45), 0 0 0 4px rgba(0, 102, 255, 0.06);
}

.toolbar-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 900;
}

.toolbar-search input,
.toolbar-select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font-weight: 700;
}

.toolbar-search input {
  width: 100%;
  min-width: 180px;
  font-size: 0.92rem;
}

.toolbar-search input::placeholder {
  color: #94a3b8;
  font-weight: 700;
}

.toolbar-select-wrap {
  position: relative;
  flex: 0 0 172px;
}

.toolbar-select-wrap::after {
  content: '▾';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.toolbar-select {
  width: 100%;
  padding: 0 38px 0 16px;
  min-height: 50px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: #fff;
  appearance: none;
  cursor: pointer;
  box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.28);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.toolbar-select:focus {
  border-color: rgba(0, 102, 255, 0.45);
  box-shadow: 0 16px 30px -22px rgba(0, 102, 255, 0.45), 0 0 0 4px rgba(0, 102, 255, 0.06);
}

.survey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 14px 30px -26px rgba(15, 23, 42, 0.35);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.survey-row:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 102, 255, 0.2);
  box-shadow: 0 18px 40px -28px rgba(0, 102, 255, 0.35);
}

.survey-row[hidden] {
  display: none !important;
}

.survey-row.page-hidden {
  display: none !important;
}

.survey-row h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  color: var(--text-main);
}

.survey-main {
  flex: 1;
  min-width: 0;
}

.survey-row p {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.survey-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.survey-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
}

.survey-row[data-status="draft"] .survey-status {
  background: #f1f5f9;
  color: #64748b;
}

.survey-row[data-status="dimensions_done"] .survey-status {
  background: #eef6ff;
  color: #2563eb;
}

.survey-row[data-status="survey_done"] .survey-status {
  background: #eff6ff;
  color: #0ea5e9;
}

.survey-row[data-status="result_generating"] .survey-status {
  background: #fff7ed;
  color: #f97316;
}

.survey-row[data-status="result_generating"] .survey-status::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45);
  animation: statusPulse 1.4s infinite;
}

.survey-row[data-status="result_done"] .survey-status {
  background: #ecfdf5;
  color: #10b981;
}

.survey-row[data-status="result_failed"] .survey-status {
  background: #fef2f2;
  color: #ef4444;
}

@keyframes statusPulse {
  70% {
    box-shadow: 0 0 0 8px rgba(249, 115, 22, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
  }
}

.survey-audience {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 800;
}

.survey-updated {
  margin-left: auto;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn.small {
  padding: 9px 14px;
  font-size: 0.82rem;
  width: auto;
  min-width: 74px;
  text-decoration: none;
  white-space: nowrap;
}

.btn.small:hover,
.btn.small:focus {
  text-decoration: none;
}

.btn-danger-soft {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 10px 20px -5px rgba(239, 68, 68, 0.25);
}

.btn-danger-soft:hover {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #ffffff;
  box-shadow: 0 15px 25px -5px rgba(239, 68, 68, 0.35);
}

.btn-ghost {
  background: #f1f5f9;
  color: var(--text-main);
  box-shadow: none;
}

.btn-ghost:hover {
  background: #e8f1ff;
  color: var(--primary);
}

.empty-state {
  padding: 64px 16px;
  text-align: center;
}

.empty-illustration {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary-light), #f3e8ff);
  color: var(--primary);
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 18px 36px -24px rgba(0, 102, 255, 0.5);
}

.empty-state h3 {
  margin-bottom: 10px;
  color: var(--text-main);
}

.empty-state p {
  margin-bottom: 22px;
  color: var(--text-muted);
}

.empty-action {
  width: auto;
  min-width: 180px;
  display: inline-flex;
  text-decoration: none;
}

.dashboard-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  padding-top: 4px;
}

.dashboard-pagination[hidden] {
  display: none !important;
}

.page-btn {
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px -16px rgba(15, 23, 42, 0.28);
  transition: all 0.18s ease;
}

.page-btn:hover:not(:disabled) {
  color: var(--primary);
  border-color: rgba(0, 102, 255, 0.45);
  transform: translateY(-1px);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.page-info {
  min-width: 72px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
}

.save-indicator::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.save-indicator.saved {
  background: #ecfdf5;
  color: #10b981;
}

.save-indicator.saving {
  background: #eef6ff;
  color: var(--primary);
}

.save-indicator.error {
  background: #fef2f2;
  color: #ef4444;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.modal-mask[hidden] {
  display: none !important;
}

.modal-mask.show {
  opacity: 1;
}

.modal-card {
  width: min(430px, 100%);
  padding: 26px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 24px 70px -24px rgba(15, 23, 42, 0.35);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.16s ease;
}

.modal-mask.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-card h3 {
  margin-bottom: 18px;
  color: var(--text-main);
}

.danger-modal p {
  margin: -6px 0 20px;
  color: var(--text-muted);
  line-height: 1.7;
}

.modal-label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 800;
}

.modal-label input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  outline: 0;
  background: #f8fbff;
}

.modal-label input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.08);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.result-panel {
  max-width: 1100px;
}

.result-readonly {
  margin-top: 20px;
}

@media (max-width: 768px) {
  .auth-card,
  .dashboard-panel {
    padding: 22px 16px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .survey-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-select-wrap {
    flex-basis: auto;
  }

  .row-actions,
  .row-actions .btn {
    width: 100%;
  }
}
