/* Public registration page (slice 0075-04). Tokens from variables.css. */

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

body {
  margin: 0;
  background: #eef3f8;
  color: #1f2937;
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

/* ========== HEADER ========== */
.site-header {
  background: var(--panel-header-bg);
  color: #ffffff;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.session-timer {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.session-timer.warn {
  background: #fbbf24;
  color: #451a03;
}

/* ========== LAYOUT ========== */
.wizard {
  max-width: 760px;
  margin: 24px auto 48px;
  padding: 0 16px;
}

.card {
  margin-top: 16px;
  padding: 24px;
  border-radius: 10px;
  background: var(--panel-body-background);
  box-shadow: 0 2px 12px rgba(15, 40, 80, 0.08);
}

.card h2 {
  margin: 0 0 6px;
  color: var(--primary-color-dark);
  font-size: 20px;
  line-height: 1.3;
}

.card h2:focus {
  outline: none;
}

.lead {
  margin: 0 0 8px;
  color: #4b5563;
}

/* ========== STEPPER ========== */
.stepper {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper li {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #6b7280;
  font-size: 13px;
}

.stepper li:last-child {
  flex: 0 0 auto;
}

.stepper li:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 2px;
  margin: 0 6px;
  border-radius: 1px;
  background: #d1d5db;
}

.stepper li.done::after {
  background: var(--primary-color);
}

.step-num {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  font-weight: 700;
  font-size: 12px;
}

.step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stepper li.current {
  color: var(--primary-color-dark);
  font-weight: 600;
}

.stepper li.current .step-num {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #ffffff;
}

.stepper li.done {
  cursor: pointer;
  color: #374151;
}

.stepper li.done .step-num {
  border-color: var(--primary-color);
  color: var(--primary-color-dark);
}

.stepper li.done:hover .step-label {
  text-decoration: underline;
}

/* ========== FIELDS ========== */
.field-label {
  display: block;
  margin: 18px 0 6px;
  color: #374151;
  font-weight: 600;
  font-size: 13px;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-row .text-input {
  flex: 1 1 220px;
  min-width: 0;
}

.text-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(48, 158, 255, 0.2);
}

.text-input[readonly] {
  background: #f3f4f6;
  color: #4b5563;
}

.field-row .code-input {
  flex: 0 1 180px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 4px;
}

.hint {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 13px;
}

/* A hint between a field's label and the field itself. */
.hint-above {
  margin: -2px 0 8px;
}

.sub-block {
  margin-top: 8px;
}

/* The tree's own input carries no border; the box around it does. */
.field-control {
  position: relative;
  display: flex;
  align-items: center;
  height: 40px;
  padding-right: 36px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-control:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(48, 158, 255, 0.2);
}

.field-control .treeview-input {
  height: 100%;
  padding: 0 12px;
  font-size: 15px;
}

.field-control .treeview-input:hover:not(:disabled) {
  border-radius: 6px 0 0 6px;
}

.field-control .treeview-arrow {
  width: 36px;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
}

/* The dropdown lives on <body>; keep it inside the viewport and let long captions ellipsize. */
.treeview {
  max-width: min(680px, calc(100vw - 40px));
}

.combo-field {
  display: block;
  max-width: 180px;
}

.combo-field .combobox-input {
  height: 40px;
  padding: 0 36px 0 12px;
  border-color: var(--border-color);
  border-radius: 6px;
  font-size: 15px;
}

.combo-field .combobox-arrow {
  right: 10px;
  font-size: 12px;
}

/* The sector captions are long; the library caps its dropdown at 320px. */
.combo-field-wide {
  max-width: 100%;
}

.combo-field-wide .combobox-dropdown {
  max-width: none;
}

/* Sector combobox and the Add button on one line; the button drops under it on a phone. */
.ss-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ss-pick .combo-field-wide {
  flex: 1 1 260px;
  min-width: 0;
}

.ss-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.ss-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
}

.ss-list li + li {
  border-top: 1px solid var(--border-color);
}

.ss-list .ss-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ss-list .btn-link {
  flex-shrink: 0;
  margin: 0;
}

.combo-field .combobox-option {
  max-height: none;
  font-size: 14px;
}

/* ========== NOTES, MESSAGES, CARDS ========== */
.info-card {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f5f9ff;
}

.info-card .hint {
  margin-top: 10px;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}

.kv dt {
  color: #6b7280;
}

.kv dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.summary {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #f9fafb;
}

.ok-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 500;
}

.rows-note {
  margin: 20px 0 0;
  padding: 10px 14px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  font-weight: 500;
}

.msg {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
}

.msg-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.msg-info {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.msg .btn-link {
  margin: 0 0 0 4px;
  color: inherit;
  font-weight: 600;
}

/* ========== BUTTONS ========== */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f0f2f5;
}

.btn {
  position: relative;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}

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

.btn-primary:hover:not(:disabled) {
  filter: brightness(0.92);
}

.btn-secondary {
  border-color: var(--border-color);
  background: #ffffff;
  color: #374151;
}

.btn-secondary:hover:not(:disabled) {
  background: #f3f4f6;
}

.btn:focus-visible,
.btn-link:focus-visible {
  outline: 3px solid rgba(48, 158, 255, 0.45);
  outline-offset: 2px;
}

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

.btn.is-busy {
  color: transparent;
  opacity: 1;
}

.btn.is-busy::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}

.btn-secondary.is-busy::after {
  border-color: #d1d5db;
  border-top-color: #374151;
}

.btn-link {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-color-dark);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}

.btn-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ok-note .btn-link {
  margin: 0;
  color: inherit;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== DONE ========== */
.done-panel {
  text-align: center;
}

.done-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 8px auto 14px;
  border-radius: 50%;
  background: #16a34a;
  color: #ffffff;
  font-size: 28px;
  font-weight: 700;
}

.done-panel strong {
  font-size: 18px;
}

/* ========== NARROW SCREENS ========== */
@media (max-width: 600px) {
  .wizard {
    margin-top: 16px;
  }

  .card {
    padding: 18px 16px;
  }

  /* No room for the words; the card heading names the step. */
  .stepper .step-label {
    display: none;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .kv dd {
    margin-bottom: 8px;
  }

  .brand-title {
    font-size: 14px;
  }
}
