/* Formalar, modal oynalar va bildirishnomalar. */
/* ---- Formalar ---- */
.form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 550;
}

.field-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: var(--faint);
}

.input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

textarea.input {
  resize: vertical;
  line-height: 1.5;
}

input[type='file'].input {
  padding: 8px;
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
}

.segmented label,
.segmented button {
  position: relative;
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked),
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
}

.checklist {
  display: grid;
  gap: 2px;
  max-height: 210px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.check:hover {
  background: var(--surface-2);
}

.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  color: var(--red);
  font-size: 13.5px;
  font-weight: 500;
}

/* ---- Modal va bildirishnomalar ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 14, 13, 0.5);
  backdrop-filter: blur(3px);
  animation: fade 0.15s ease-out;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(92dvh, 860px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s ease-out;
}

.modal.wide {
  width: min(720px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px 24px;
}

.modal-body {
  padding: 4px 24px 22px;
  overflow: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
}

.modal form {
  display: contents;
}

#toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: pop 0.18s ease-out;
}

.toast.error {
  background: var(--red);
  color: #fff;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* iOS Safari 16px dan kichik maydonga bosilganda sahifani kattalashtirib yuboradi. */
@media (max-width: 860px) {
  .input {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 0;
    place-items: end stretch;
  }

  .modal,
  .modal.wide {
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 94dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
