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

:root {
  --bg:        #f5f7fa;
  --surface:   #ffffff;
  --surface2:  #eef0f5;
  --border:    #d0d4e0;
  --accent:    #2563eb;
  --accent2:   #7c3aed;
  --text:      #111827;
  --muted:     #374151;
  --dim:       #6b7280;
  --error:     #dc2626;
  --success:   #16a34a;
  --radius:    10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px 80px;
}

.page-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
}

/* ── Header ── */
.form-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.header-badge {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb15, #7c3aed15);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-badge svg {
  width: 28px;
  height: 28px;
  stroke: var(--accent);
}

.header-text h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
}

.header-text p {
  margin-top: 5px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Section divider ── */
.section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Field group ── */
.field {
  margin-bottom: 24px;
}

label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.hint {
  font-family: 'DM Mono', monospace;
  font-size: 0.67rem;
  color: var(--dim);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.req { color: var(--accent); font-size: 0.9em; }

/* Inputs */
input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder { color: var(--dim); }

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #2563eb18;
  background: var(--surface2);
}

textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.65;
}

/* Select wrapper */
.select-wrap {
  position: relative;
}

.select-wrap select {
  padding-right: 44px;
  cursor: pointer;
}

.select-wrap select option {
  background: var(--surface);
  color: var(--text);
}

.chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.loading-note {
  font-size: 0.73rem;
  font-family: 'DM Mono', monospace;
  color: var(--accent);
  margin-top: 6px;
  opacity: 0.65;
  display: flex;
  align-items: center;
  gap: 6px;
}

.loading-note.hidden { display: none; }

.dot-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1.1); }
}

/* ── Opp search dropdown ── */
.opp-search-wrap {
  position: relative;
}

.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-dropdown .dd-item {
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.search-dropdown .dd-item:last-child { border-bottom: none; }

.search-dropdown .dd-item:hover,
.search-dropdown .dd-item.active {
  background: var(--surface2);
  color: var(--accent);
}

.search-dropdown .dd-empty {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--dim);
}

/* ── Dropzone ── */
.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s, background 0.18s;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: #2563eb07;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.drop-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px;
  gap: 6px;
  pointer-events: none;
  text-align: center;
}

.drop-icon {
  width: 42px;
  height: 42px;
  stroke: var(--accent);
  opacity: 0.5;
  margin-bottom: 6px;
}

.drop-body p {
  font-size: 0.88rem;
  color: var(--muted);
}

.drop-body strong { color: var(--text); }
.drop-body .browse { color: var(--accent); text-decoration: underline; cursor: pointer; }

.drop-body .drop-meta {
  font-size: 0.75rem;
  color: var(--dim);
  margin-top: 2px;
}

/* File chips */
.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 0.78rem;
  color: var(--text);
  max-width: 240px;
}

.chip svg {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  stroke: var(--accent);
}

.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip .remove {
  flex-shrink: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  margin-left: 2px;
  transition: color 0.15s;
}

.chip .remove:hover { color: var(--error); }

/* ── Validation errors ── */
.err {
  display: block;
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 5px;
  min-height: 1em;
}

/* ── Submit button ── */
.submit-row {
  margin-top: 40px;
}

button[type="submit"] {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.18s, transform 0.15s;
}

button[type="submit"]:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

button[type="submit"]:active:not(:disabled) { transform: translateY(0); }
button[type="submit"]:disabled { opacity: 0.55; cursor: not-allowed; }

.spin {
  width: 18px;
  height: 18px;
  animation: rotate 0.75s linear infinite;
}

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

/* ── Result banner ── */
.result {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
  display: none;
}

.result.success {
  background: #0fd49415;
  border: 1px solid var(--success);
  color: var(--success);
}

.result.error {
  background: #f05c6a12;
  border: 1px solid var(--error);
  color: var(--error);
}

/* ── Responsive ── */
@media (max-width: 520px) {
  body { padding: 28px 16px 60px; }
  .form-header { flex-direction: column; align-items: flex-start; }
}
