/* styles.css */
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fff;
  --card: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --primary: #000;
  --primary-hover: #1a1a1a;
  --danger: #dc2626;
  --text: #111827;
  --text-muted: #6b7280;
  --text-label: #374151;
  --success: #16a34a;
  --radius: 8px;
  --upload-bg: #f9fafb;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
  line-height: 1.6;
}

#root {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}

.page-header {
  display: grid;
  grid-template-columns: 280px 1fr;
  align-items:  start;
  gap: 40px;
  margin-bottom: 40px;
}

.page-logo {
  display: block;
  width: auto;
  height: 55px;
  padding-top: 20px;
}

.page-header h1 {
  color: var(--text);
  margin-bottom: 4px;
  font-size: 24px;
  font-weight: 700;
}

.page-header .page-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.page-header p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 14px;
}

.page-instructions {
  position: relative;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 10px;
}

.page-instructions p {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.page-instructions p:last-child {
  margin-bottom: 0;
}

.page-instructions ul {
  margin: 0 0 12px 20px;
  padding: 0;
}

.page-instructions li {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.page-instructions .required {
  color: var(--danger);
}

.type-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  overflow: hidden;
  border-radius: 9999px;
}

.type-toggle button {
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 10px 28px;
  transition: all .15s;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

.type-toggle button.active {
  background: var(--primary);
  color: #fff;
}

.type-toggle button:not(.active):hover {
  background: #f3f4f6;
}

.page-instructions > .instructions-menu {
  position: absolute;
  z-index: 10;
  top: 12px;
  right: 12px;
}

.saved-badge {
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
}

.draft-badge {
  color: var(--text-muted);
  font-size: 12px;
}

.session-menu-wrap {
  position: relative;
}

.btn-icon {
  min-width: 32px;
  padding: 6px 10px;
  font-size: 18px;
  line-height: 1;
}

.btn-ghost {
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 6px;
}

.btn-ghost:hover {
  color: var(--text);
  background: #0000000a;
}

.session-dropdown {
  position: absolute;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 100;
  overflow: hidden;
  min-width: 200px;
  margin-top: 4px;
  top: 100%;
  right: 0;
  box-shadow: 0 4px 12px #0000001a;
}

.session-dropdown-info {
  color: var(--text-muted);
  padding: 10px 14px;
  font-size: 12px;
}

.session-dropdown-label {
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
}

.session-dropdown-info code {
  color: var(--text);
  background: #e5e7eb;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
}

.session-dropdown-item {
  display: block;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background: none;
  border: none;
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
}

.session-dropdown-item:hover {
  background: var(--card);
}

.session-dropdown-item:active {
  background: var(--border);
}

.form-section {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  padding: 32px 0;
}

.form-section:first-of-type {
  padding-top: 0;
}

.section-label {
  position: sticky;
  align-self:  start;
  top: 24px;
}

.section-label h2 {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 600;
}

.section-label p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-content {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.full-width {
  grid-column: 1 / -1;
}

.form-grid .full-width .upload-slot {
  width: 100%;
}

.form-grid .full-width .upload-area {
  box-sizing: border-box;
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  color: var(--text-label);
  font-size: 13px;
  font-weight: 500;
}

.field label .required {
  color: var(--danger);
  margin-left: 2px;
}

input:not([type="checkbox"]), select, textarea {
  border: 1px solid var(--border);
  color: var(--text);
  background: #fff;
  border-radius: 6px;
  width: 100%;
  padding: 9px 12px;
  transition: border-color .15s;
  font-family: inherit;
  font-size: 14px;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.custom-select-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.field .custom-select-wrap {
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  border: 1px solid var(--border);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: #fff;
  border-radius: 6px;
  justify-content: space-between;
  align-items:  center;
  width: 100%;
  padding: 9px 32px 9px 12px;
  transition: border-color .15s;
  font-family: inherit;
  font-size: 14px;
}

.custom-select-trigger:hover {
  border-color: var(--border-strong);
}

.custom-select-trigger:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px #0000000f;
}

.custom-select-trigger .placeholder {
  color: #9ca3af;
}

.custom-select-chevron {
  position: absolute;
  color: var(--text-muted);
  pointer-events: none;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
}

.custom-select-dropdown {
  position: absolute;
  border: 1px solid var(--border);
  z-index: 50;
  overflow: hidden;
  background: #fff;
  border-radius: 6px;
  margin-top: 4px;
  top: 100%;
  left: 0;
  right: 0;
  box-shadow: 0 4px 12px #0000001a;
}

.custom-select-list {
  overflow-y: auto;
  max-height: 240px;
  padding: 4px 0;
}

.custom-select-option {
  display: block;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background: none;
  border: none;
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
}

.custom-select-option:hover {
  background: var(--card);
}

.custom-select-option.selected {
  background: #0000000f;
  font-weight: 500;
}

.custom-select-option.selected:after {
  content: " ✓";
  font-weight: 400;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px #0000000f;
}

input::placeholder, textarea::placeholder {
  color: #9ca3af;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
  background: #fff;
  border-radius: 9999px;
  align-items:  center;
  gap: 6px;
  padding: 6px 14px;
  transition: all .15s;
  font-size: 13px;
}

.checkbox-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.checkbox-group input {
  display: none;
}

.id-doc-single-side-wrap {
  display: flex;
  align-items:  center;
}

.switch-label {
  display: inline-flex;
  cursor: pointer;
  color: var(--text);
  user-select: none;
  align-items:  center;
  gap: 10px;
  font-size: 14px;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: relative;
  background: var(--border-strong);
  border-radius: 22px;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  transition: background .2s;
}

.switch-slider:after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  transition: transform .2s;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px #0003;
}

.switch-input:checked + .switch-slider {
  background: var(--primary);
}

.switch-input:checked + .switch-slider:after {
  transform: translateX(18px);
}

.switch-input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 2px var(--primary);
}

.switch-text {
  font-weight: 500;
}

.upload-slot {
  margin-bottom: 16px;
}

.upload-slot-label {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.upload-slot-desc {
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 12px;
}

.upload-area {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  background: #fff;
  padding: 24px 16px;
  transition: all .15s;
}

.upload-area:hover {
  background: var(--upload-bg);
  border-color: #9ca3af;
}

.upload-area input[type="file"] {
  display: none;
}

.upload-area .upload-icon {
  color: #9ca3af;
  margin-bottom: 8px;
  font-size: 24px;
}

.upload-area .upload-text {
  color: var(--text-muted);
  font-size: 13px;
}

.upload-area .upload-text strong {
  color: var(--text);
}

.upload-area .upload-hint {
  color: #9ca3af;
  margin-top: 4px;
  font-size: 11px;
}

.upload-area.uploading {
  opacity: .6;
  pointer-events: none;
}

.upload-area.has-file {
  border-style: solid;
  border-color: var(--success);
  background: #f0fdf4;
}

.uploaded-file {
  display: flex;
  border: 1px solid var(--border);
  background: #f9fafb;
  border-radius: 6px;
  justify-content: space-between;
  align-items:  center;
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.uploaded-file .file-info {
  display: flex;
  align-items:  center;
  gap: 8px;
  min-width: 0;
}

.uploaded-file .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploaded-file .file-check {
  color: var(--success);
  font-weight: 600;
}

.uploaded-file .remove-btn {
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  transition: all .15s;
  font-size: 16px;
}

.uploaded-file .remove-btn:hover {
  color: var(--danger);
  background: #fef2f2;
}

.owner-card {
  padding-top: 20px;
}

.owner-card:first-child {
  padding-top: 0;
}

.owner-card-header {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  margin-bottom: 20px;
}

.owner-card-header h3 {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.owner-subsection {
  margin-top: 24px;
  padding-top: 0;
}

.owner-subsection h4 {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.doc-subsection {
  padding-bottom: 8px;
}

.doc-subsection:last-child {
  padding-bottom: 0;
}

.doc-subsection h4 {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.doc-subsection h4 .required {
  color: var(--danger);
  margin-bottom: 4px;
  margin-left: 2px;
}

.doc-subsection .doc-desc {
  color: var(--text-muted);
  margin-bottom: 12px;
  font-size: 12px;
}

.btn {
  cursor: pointer;
  display: inline-flex;
  border: none;
  border-radius: 6px;
  align-items:  center;
  gap: 6px;
  padding: 10px 20px;
  transition: all .15s;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  color: var(--danger);
  border: 1px solid var(--danger);
  background: none;
}

.btn-danger:hover {
  background: #fef2f2;
}

.btn-outline {
  color: var(--text);
  border: 1px solid var(--border);
  background: none;
}

.btn-outline:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-confirm {
  background: var(--primary);
  color: #fff;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}

.btn-confirm:hover {
  background: var(--primary-hover);
}

.btn-add-owner {
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  cursor: pointer;
  background: none;
  border-radius: 6px;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  transition: all .15s;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

.btn-add-owner:hover {
  background: var(--upload-bg);
  color: var(--text);
  border-color: #9ca3af;
}

.submit-bar {
  display: flex;
  gap: 12px;
  margin-top: 0;
  padding: 32px 0 0;
}

.submit-bar .btn-primary {
  flex: 1;
  justify-content: center;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
}

.toast {
  position: fixed;
  border-radius: var(--radius);
  color: #fff;
  z-index: 200;
  animation: slideIn .3s ease;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  top: 20px;
  right: 20px;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.field-error {
  animation: fieldShake .4s ease;
}

.field-error input, .field-error textarea, .field-error .custom-select-trigger, .field-error .upload-slot {
  box-shadow: 0 0 0 2px #dc262626;
  border-color: var(--danger) !important;
}

@keyframes fieldShake {
  0%, 100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-4px);
  }

  40% {
    transform: translateX(4px);
  }

  60% {
    transform: translateX(-2px);
  }

  80% {
    transform: translateX(2px);
  }
}

.submitted-screen {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 60px 24px;
}

.submitted-icon {
  animation: scaleIn .4s ease;
  margin-bottom: 24px;
}

.submitted-title {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 24px;
  font-weight: 700;
}

.submitted-message {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 1.6;
}

.submitted-reference {
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 14px;
}

.submitted-reference code {
  background: var(--card);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 13px;
}

.submitted-note {
  color: var(--text-muted);
  font-size: 13px;
}

.submitted-badge {
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
}

@keyframes scaleIn {
  from {
    transform: scale(.5);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.admin-field-value {
  border: 1px solid var(--border);
  color: var(--text);
  background: #fff;
  border-radius: 6px;
  min-height: 38px;
  padding: 9px 12px;
  font-size: 14px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.admin-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
}

.admin-table td {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  padding: 12px 16px;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: #f9fafb;
}

.admin-td-name {
  font-weight: 600;
}

.admin-status {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: .3px;
  border-radius: 9999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

.admin-status-draft {
  color: #92400e;
  background: #fef3c7;
}

.admin-status-submitted, .admin-status-pending {
  color: #1e40af;
  background: #dbeafe;
}

.admin-status-approved {
  color: #166534;
  background: #dcfce7;
}

.admin-status-rejected {
  color: #991b1b;
  background: #fee2e2;
}

.admin-pill {
  display: inline-block;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 400;
}

@media (width <= 768px) {
  .page-header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 36px;
    padding: 8px 0 0;
  }

  .page-logo {
    height: 32px;
    padding-top: 0;
  }

  .form-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .section-label {
    position: static;
  }

  .form-grid, .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .type-toggle {
    width: 100%;
  }

  .type-toggle button {
    flex: 1;
  }

  #root {
    padding: 20px 16px 100px;
  }
}
